-
Notifications
You must be signed in to change notification settings - Fork 0
/
auth.Dockerfile
46 lines (33 loc) · 1.26 KB
/
auth.Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Use Node 22.12 bookworm as base image
FROM node:22.12-bookworm AS base
# Development stage
# =============================================================================
# Create a development stage based on the "base" image
FROM base AS development
# Change the working directory to /node
WORKDIR /node
# Copy the package.json and package-lock.json files to /node
COPY package*.json ./
# Install all dependencies and clean the cache
RUN npm ci && npm cache clean --force
# Change the working directory to /node/app
# This is where the project directory will be mounted to
WORKDIR /node/app
# Run the `dev` script for auto-reloading
CMD ["npm", "run", "dev:auth"]
# Production stage
# =============================================================================
# Create a production stage based on the "base" image
FROM base AS production
# Change the working directory to /build
WORKDIR /build
# Copy the package.json and package-lock.json files to the /build directory
COPY package*.json ./
# Install production dependencies and clean the cache
RUN npm ci --omit=dev && npm cache clean --force
# Copy the entire source code into the container
COPY . .
# Document the port that may need to be published
EXPOSE 8000
# Start the application
CMD ["npm", "run", "start:auth"]