-
Notifications
You must be signed in to change notification settings - Fork 19
/
Dockerfile
43 lines (32 loc) · 1.08 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
# Stage 1: Build the application
FROM node:18 AS build
# Set the working directory
WORKDIR /app
# Copy package.json and package-lock.json
COPY package.json package-lock.json ./
# Install dependencies
RUN npm ci
# Copy the rest of the application code
COPY . .
# Build the application
RUN npm run build
# Stage 2: Create the runtime environment
FROM node:18-alpine AS runtime
# Set the working directory
WORKDIR /app
# Copy only the necessary files from the build stage
COPY --from=build /app/package.json /app/package-lock.json ./
COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/backend ./backend
COPY --from=build /app/public ./public
COPY --from=build /app/private-key.pem ./private-key.pem
COPY --from=build /app/public-key.pem ./public-key.pem
COPY --from=build /app/src/isomorphic ./src/isomorphic
COPY --from=build /app/build ./build
# Set environment variables
ENV NODE_ENV "production"
ENV PORT "80"
# Expose the port
EXPOSE 80
# Command to run the application
CMD ["/app/node_modules/.bin/ts-node", "--skipProject", "--transpile-only", "./backend/index.ts"]