Read secret from docker secrets

This commit is contained in:
2025-11-01 11:09:59 +07:00
parent 04c48e67b8
commit bec4c0af97
9 changed files with 130 additions and 283 deletions

View File

@@ -1,38 +1,22 @@
# --- Stage 1: Build & Install Dependencies ---
FROM node:18-alpine AS builder
# Use an official Node.js image as the base
FROM node:22.14.0-alpine
WORKDIR /app
# Copy package.json and lock file (if used) from source subdir
COPY /src/Managing.Web3Proxy/package*.json ./
ENV NODE_ENV production
# Install dependencies (development dependencies are fine here)
RUN npm ci --no-audit --fund=false
# Copy the rest of the source code
COPY src/Managing.Web3Proxy/ .
# Run the build script
RUN npm run build
# --- Stage 2: Production Runtime ---
FROM node:22.14.0-alpine AS production
WORKDIR /app
# Copy essential files from the builder stage
COPY --from=builder /app/package*.json ./
COPY --from=builder /app/node_modules/ ./node_modules/
# Copy the compiled application code (assuming 'dist' is the output folder)
COPY --from=builder /app/dist/ ./dist/
# Set production environment again for the runtime stage
ENV NODE_ENV production
EXPOSE 4111
# Start the application from the compiled output
CMD ["fastify", "start", "-l", "info", "dist/app.js"]
# Set the working directory in the container
WORKDIR /app
# COPY package*.json ./
COPY /src/Managing.Web3Proxy/package.json ./
# Declaring env
ENV NODE_ENV production
# Install dependencies with the --legacy-peer-deps flag to bypass peer dependency conflicts
RUN npm install
COPY src/Managing.Web3Proxy/ .
RUN npm run build
EXPOSE 4111
CMD ["npm", "run", "start"]