test build
This commit is contained in:
parent
1837cf09ac
commit
837925b926
3 changed files with 35 additions and 35 deletions
1
.github/workflows/release.yaml
vendored
1
.github/workflows/release.yaml
vendored
|
|
@ -52,6 +52,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
|
||||||
|
|
|
||||||
35
Dockerfile
35
Dockerfile
|
|
@ -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
34
docker/Dockerfile
Normal 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" ]
|
||||||
Loading…
Add table
Add a link
Reference in a new issue