-
Notifications
You must be signed in to change notification settings - Fork 145
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (23 loc) · 883 Bytes
/
Dockerfile
File metadata and controls
33 lines (23 loc) · 883 Bytes
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
FROM node:22-alpine AS builder
EXPOSE 8080
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm install --no-cache
COPY . .
RUN chmod +x build.sh
RUN ./build.sh
FROM nginx:stable-alpine AS final
ARG APPLICATION_VERSION
COPY deployment/nginx.conf /etc/nginx/nginx.conf
COPY deployment/default.conf /etc/nginx/conf.d/default.conf
RUN sed -i "s|\$APPLICATION_VERSION|${APPLICATION_VERSION}|g" /etc/nginx/conf.d/default.conf
COPY --from=builder --chown=nginx:nginx /app/root/redirect.conf /etc/nginx/extra/redirect.conf
RUN rm -rf /usr/share/nginx/html/*
COPY --from=builder --chown=nginx:nginx /app/root/ /usr/share/nginx/html/
RUN rm -rf /usr/share/nginx/html/redirect.conf
RUN mkdir -p /var/cache/nginx
RUN chown -R nginx:nginx /var/cache/nginx
RUN touch /var/run/nginx.pid && \
chown -R nginx:nginx /var/run/nginx.pid
USER nginx
WORKDIR /usr/share/nginx/html