test build

This commit is contained in:
DESKTOP-2S5P7D1\Windows 10 2024-12-03 13:39:23 +07:00
parent 76a3a53385
commit 34ceb5a226
3 changed files with 35 additions and 35 deletions

View file

@ -53,6 +53,7 @@ jobs:
with: with:
context: . context: .
platforms: linux/amd64 platforms: linux/amd64
file: docker/Dockerfile
push: true push: true
tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }},${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }},${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest
- name: Remote Deployment - name: Remote Deployment

View file

@ -1,35 +0,0 @@
FROM node:18-alpine as builder
# Create app directory
WORKDIR /app
# Install app dependencies
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM node:18-alpine
ENV NODE_ENV production
USER node
# Create app directory
WORKDIR /app
# Install app dependencies
COPY package*.json ./
# COPY .env ./
RUN npm ci --production
COPY --from=builder /app/dist ./dist
# COPY entrypoint.sh /usr/local/bin/entrypoint.sh
# RUN chmod u+x /usr/local/bin/entrypoint.sh
# ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD [ "node", "dist/app.js" ]

34
docker/Dockerfile Normal file
View file

@ -0,0 +1,34 @@
# Build Stage
FROM node:lts-alpine AS build-stage
# Create app directory
WORKDIR /app
# Install app dependencies
COPY package*.json ./
RUN npm ci
# Copy source files and build the app
COPY . .
RUN npm run build
# Production Stage
FROM node:lts-alpine
ENV NODE_ENV production
USER node
# Create app directory
WORKDIR /app
# Copy built app from build stage
COPY --from=build-stage /app/dist ./dist
# Install only production dependencies
COPY package*.json ./
RUN npm ci --production
# Define the entrypoint and default command
# If you have a custom entrypoint script
CMD [ "node", "dist/app.js" ]