Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hrsystem
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
hrsystem
Commits
35beb99d
Commit
35beb99d
authored
Apr 02, 2026
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update backend/Dockerfile via Son of Anton
parent
ff7f1d41
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
35 deletions
+24
-35
Dockerfile
backend/Dockerfile
+24
-35
No files found.
backend/Dockerfile
View file @
35beb99d
# Stage 1: Build
FROM
node:20-alpine AS base
FROM
node:20-alpine AS builder
RUN
apk add
--no-cache
libc6-compat openssl
# Install dependencies
FROM
base AS deps
WORKDIR
/app
WORKDIR
/app
COPY
package.json ./
RUN
npm
install
--legacy-peer-deps
# Copy shared
package first
# Copy shared
types
COPY
../shared /
shared
FROM
base AS
shared
WORKDIR
/shared
WORKDIR
/shared
RUN
npm
install
&&
npm run build 2>/dev/null
||
true
COPY
../shared/package.json ./
COPY
../shared/src ./src
COPY
../shared/tsconfig.json ./
# Build
FROM
base AS builder
WORKDIR
/app
WORKDIR
/app
COPY
--from=deps /app/node_modules ./node_modules
COPY
. .
COPY
--from=shared /shared ../shared
# Copy package files
# Generate Prisma client
COPY
package.json package-lock.json* ./
# Install dependencies
RUN
npm ci
--legacy-peer-deps
# Copy prisma schema
COPY
../prisma ./prisma
COPY
../prisma ./prisma
RUN
npx prisma generate
RUN
npx prisma generate
--schema
=
./prisma/schema.prisma
# Copy source
COPY
. .
# Build
RUN
npm run build
RUN
npm run build
# Stage 2: Production
# Production
FROM
node:20-alpine AS runner
FROM
base AS runner
WORKDIR
/app
WORKDIR
/app
ENV
NODE_ENV=production
# Install production deps only
COPY
package.json package-lock.json* ./
RUN
npm ci
--legacy-peer-deps
--production
&&
npm cache clean
--force
# Copy built output
COPY
--from=builder /app/dist ./dist
COPY
--from=builder /app/dist ./dist
COPY
--from=builder /app/node_modules
/.prisma ./node_modules/.prisma
COPY
--from=builder /app/node_modules
./node_modules
COPY
--from=builder /app/prisma ./prisma
COPY
--from=builder /app/prisma ./prisma
COPY
--from=builder /app/package.json ./
# Create non-root user
RUN
addgroup
--system
--gid
1001 nodejs
&&
\
adduser
--system
--uid
1001 nestjs
USER
nestjs
EXPOSE
3001
EXPOSE
3001
ENV
NODE_ENV=production
CMD
["sh", "-c", "npx prisma migrate deploy --schema=./prisma/schema.prisma && node dist/main.js"]
ENV
PORT=3001
\ No newline at end of file
CMD
["node", "dist/main.js"]
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment