-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
42 lines (29 loc) · 1.16 KB
/
Copy pathDockerfile
File metadata and controls
42 lines (29 loc) · 1.16 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
### Stage 1: Build ###
FROM node:18-bullseye-slim AS build
RUN groupadd -r appgroup && useradd -r -g appgroup -d /usr/src/app -s /sbin/nologin appuser
WORKDIR /usr/src/app
COPY package.json /usr/src/app/package.json
COPY package-lock.json /usr/src/app/package-lock.json
COPY tsconfig.json /usr/src/app/tsconfig.json
COPY tsconfig.app.json /usr/src/app/tsconfig.app.json
COPY angular.json /usr/src/app/angular.json
COPY src /usr/src/app/src
COPY bin/copy-lforms.js /usr/src/app/bin/copy-lforms.js
# Set ownership and permissions before running npm install
RUN chown -R appuser:appgroup /usr/src/app
RUN chmod -R 755 /usr/src/app
USER appuser
# Install dependencies and build
RUN npm install --ignore-scripts && npm run build
### Stage 2: Run ###
FROM nginx:stable-alpine
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
## Copy default nginx config
COPY ./nginx/default.conf /etc/nginx/nginx.conf
## Copy the artifacts in dist folder to default nginx public folder
COPY --from=build /usr/src/app/dist/aphp-formbuilder /usr/share/nginx/html
RUN chown -R appuser:appgroup /usr/share/nginx/html
WORKDIR /app
USER appuser
EXPOSE 8080
CMD ["nginx", "-g", "daemon off;"]