forked from david-04/quiz-mate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
49 lines (38 loc) · 1.12 KB
/
Copy pathDockerfile
File metadata and controls
49 lines (38 loc) · 1.12 KB
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
# Use Node.js LTS as the base image
FROM node:lts-slim
# Set working directory
WORKDIR /app
# Copy package files
COPY frontend/package*.json frontend/
COPY backend/package*.json backend/
# Install dependencies
RUN cd frontend && npm install && cd ../backend && npm install
# Copy source files
COPY frontend/ frontend/
COPY backend/ backend/
COPY resources/ resources/
COPY README.md LICENSE CHANGELOG.md ./
# Build frontend
RUN cd frontend && npm run build
# Create dist directory and copy files
RUN mkdir -p dist && \
cp -r backend/* dist/ && \
mkdir -p dist/public && \
cp -r frontend/build/* dist/public/ && \
cp -r resources dist/ && \
cp README.md LICENSE CHANGELOG.md dist/
# Create config file
RUN echo "http-port = 3001\n\
https-port = 3002\n\
https-cert-file = resources/sample-ssl-certificate.pem\n\
https-key-file = resources/sample-ssl-private-key.pem\n\
static-assets-source = local" > dist/quiz-mate.cfg
# Set working directory to dist
WORKDIR /app/dist
# Expose ports
EXPOSE 3001
EXPOSE 3002
# Set environment variables
ENV NODE_ENV=production
# Start the application
CMD ["node", "src/main.js"]