-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
70 lines (53 loc) · 1.71 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# =======================
# Build Stage
# =======================
FROM node:20 AS build
# Install pnpm globally
RUN npm install -g pnpm
ENV PUPPETEER_SKIP_DOWNLOAD=true
# ENV HUSKY=0
ENV HUSKY_SKIP_HOOKS=true
# Set the working directory
WORKDIR /app
# Copy package and lock files for both client and server
COPY ./client/package.json ./client/pnpm-lock.yaml ./client/
COPY ./server/package.json ./server/pnpm-lock.yaml ./server/
# Install dependencies
RUN cd client && pnpm install
RUN cd server && pnpm install
# Copy the rest of the application code
COPY ./client ./client
COPY ./server ./server
# Copy the achievibit-beta.private-key.pem file from the server root
COPY ./server/achievibit-beta.private-key.pem ./server
# Copy server/login-app folder
COPY ./server/login-app ./server/login-app
# Build the client application
RUN cd client && pnpm run build
# Build the server application
RUN cd server && pnpm run build
# =======================
# Runtime Stage
# =======================
FROM node:20-alpine AS runtime
# Install pnpm globally
RUN npm install -g pnpm
# Set the working directory
WORKDIR /app
# Copy the built server and client files
COPY --from=build /app/server/dist ./dist
COPY --from=build /app/server/package.json ./
COPY --from=build /app/server/pnpm-lock.yaml ./
COPY --from=build /app/server/client ./client
COPY --from=build /app/server/achievibit-beta.private-key.pem ./
COPY --from=build /app/server/login-app ./login-app
# Set environment variable to skip Chromium download
ENV PUPPETEER_SKIP_DOWNLOAD=true
# ENV HUSKY=0
ENV HUSKY_SKIP_HOOKS=true
# Install only production dependencies
RUN pnpm install
# Expose the application's port
EXPOSE 10102
# Start the server application
CMD ["pnpm", "start:prod"]