This commit is contained in:
jonathang4 2025-05-30 18:58:10 +08:00
parent 6aff442200
commit c0a0c55b1d
2 changed files with 15 additions and 14 deletions

View File

@ -1,21 +1,21 @@
FROM node:20.19-slim AS BUILD_IMAGE
WORKDIR /app
COPY . /app
RUN yarn install --registry https://registry.npmmirror.com/ --ignore-engines && yarn run build
FROM node:20.19-slim
COPY --from=BUILD_IMAGE /app/configs /app/configs
COPY --from=BUILD_IMAGE /app/package.json /app/package.json
COPY --from=BUILD_IMAGE /app/dist /app/dist
COPY --from=BUILD_IMAGE /app/public /app/public
COPY --from=BUILD_IMAGE /app/node_modules /app/node_modules
WORKDIR /app
# Copy application dependency manifests to the container image.
# A wildcard is used to ensure both package.json AND package-lock.json are copied.
# Copying this first prevents re-running npm install on every code change.
COPY package*.json ./
# Install dependencies
RUN yarn install --registry https://registry.npmmirror.com/ --ignore-engines
# Copy the rest of the application files to the container image.
COPY . .
# Build the application
RUN yarn run build
EXPOSE 3302
CMD ["npm", "start"]

View File

@ -5,6 +5,7 @@ services:
build:
context: ./
dockerfile: Dockerfile
image: jimeng-free-api:latest
container_name: jimeng-free-api
volumes:
- ./:/app