-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
46 lines (32 loc) · 811 Bytes
/
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 a multi-stage build for efficiency
FROM node:22-alpine AS builder
WORKDIR /tmp/
# Coping Web to tmp directory
COPY web/ . web/
COPY server/ . server/
# Install dependencies for backend
WORKDIR /tmp/server
RUN npm install
# Install dependencies for frontend
WORKDIR /tmp/web
RUN npm install
# TODO: get real env from somewhere better
RUN cp .env.example .env.production
# Build frontend
RUN npm run build
WORKDIR /usr/src/app
# Copy backend
COPY server/ .
RUN npm install
# Build Backend
RUN npm run build
# Copy static frontent to public folder in backend
RUN mkdir -p ./dist/src/public
RUN cp -a /tmp/web/dist/. ./dist/src/public/
RUN ls -la ./dist/src/public
# Define ENV Variables
ENV ADDRESS=0.0.0.0
ENV PORT=8080
ENV NODE_ENV=production
# Start application \
CMD ["npm", "run", "start"]