Upload Dockerfile
Browse files- Dockerfile +32 -0
Dockerfile
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Stage 1 - build environment
|
2 |
+
FROM node:22-alpine AS build
|
3 |
+
|
4 |
+
RUN apk add --no-cache python3 make g++ git
|
5 |
+
|
6 |
+
# Create app directory
|
7 |
+
WORKDIR /usr/src/app
|
8 |
+
|
9 |
+
# Swtich to node user
|
10 |
+
#RUN chown node:node ./
|
11 |
+
#USER node
|
12 |
+
|
13 |
+
COPY .npmrc ./
|
14 |
+
COPY package*.json ./
|
15 |
+
|
16 |
+
# Install app dependencies
|
17 |
+
RUN npm ci
|
18 |
+
|
19 |
+
# Copy all required files
|
20 |
+
COPY . .
|
21 |
+
|
22 |
+
# Build the application
|
23 |
+
RUN npm run build:web
|
24 |
+
|
25 |
+
# Stage 2 - the production environment
|
26 |
+
FROM nginx:stable-alpine
|
27 |
+
|
28 |
+
# Copy artifacts and nignx.conf
|
29 |
+
COPY --from=build /usr/src/app/dist/browser /usr/share/nginx/html
|
30 |
+
COPY --from=build /usr/src/app/docker/nginx.conf /etc/nginx/conf.d/default.conf
|
31 |
+
|
32 |
+
CMD sed -i "s#http://localhost:3333#$BACKEND_URL#g" /usr/share/nginx/html/main.js && nginx -g 'daemon off;'
|