-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
56 lines (42 loc) · 1.18 KB
/
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
47
48
49
50
51
52
53
54
55
56
# ---- Base Node ----
FROM node:22.12.0-alpine3.20 AS base
# Set working directory
WORKDIR /usr/src/app
# Copy project file
COPY package*.json ./
# Copy ts config
COPY tsconfig.json ./
# ---- Dependencies ----
FROM base AS dependencies
# Install production dependencies
RUN npm ci
RUN npm install -g ts-node
# ---- Copy Files/Build ----
FROM dependencies AS build
# Copy app files
COPY . .
# Build app
RUN npm run build
# # Remove devDependencies
RUN npm prune --production
# ---- Release ----
FROM base AS release
# Copy production dependencies
COPY --from=dependencies /usr/src/app/node_modules ./node_modules
# Copy build files from build stage
COPY --from=build /usr/src/app/dist ./dist
# copy mail templates
COPY --from=build /usr/src/app/src/mail/mail-templates ./src/mail/mail-templates
ARG GIT_REVISION
RUN echo "Git revision: $GIT_REVISION"
ENV GIT_REVISION=$GIT_REVISION
ARG GIT_BRANCH
RUN echo "Git branch: $GIT_BRANCH"
ENV GIT_BRANCH=$GIT_BRANCH
ARG PACKAGE_JSON_B64
RUN echo "Package.json: $PACKAGE_JSON_B64"
ENV PACKAGE_JSON_B64=$PACKAGE_JSON_B64
# Expose port
EXPOSE 3000
# CMD npm run migration:run:prod && npm run seed:run:prod && npm run start:prod
CMD npm run start:prod