-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDockerfile
53 lines (44 loc) · 1.59 KB
/
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
47
48
49
50
51
52
53
FROM alpine:3.20 AS frontend
RUN apk update && apk upgrade && \
apk add --no-cache \
nginx=1.26.1-r0 \
openrc=0.54-r1 \
openssl=3.3.1-r0 \
openssh=9.7_p1-r3 \
curl=8.7.1-r0 \
bash=5.2.26-r0 \
nodejs \
npm
RUN addgroup -S www && adduser -D -S -G www www && \
mkdir -p /www/src && \
chown -R www:www /var/lib/nginx && \
chown -R www:www /var/lib/nginx/logs/ && \
chown -R www:www /www && \
mkdir -p /etc/nginx/ssl && \
chown -R www:www /etc/nginx/ssl && \
chown -R www:www /etc/nginx
COPY --chown=www:www ./Frontend/index.html /www/index.html
WORKDIR /app
COPY --chown=www:www ./Frontend/tools.sh /app/tools.sh
RUN chmod +x /app/tools.sh
# # Copy package.json and package-lock.json
COPY --chown=www:www ./Frontend/package.json /app/package.json
COPY --chown=www:www ./Frontend/package-lock.json /app/package-lock.json
COPY --chown=www:www ./Frontend/vite.config.js /app/vite.config.js
# Copy your frontend application files
WORKDIR /app
COPY --chown=www:www ./Frontend /app
RUN chown -R www:www /app
# Install npm dependencies and build the project
RUN npm cache clean --force && \
rm -rf node_modules package-lock.json
RUN npm install
RUN npm run build
# Copy the built files to the nginx directory
RUN cp -r /app/dist/* /www
COPY --chown=www:www ./Frontend/nginx.conf /etc/nginx/nginx.conf
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 CMD curl -sSf http://localhost:443 > /dev/null && echo "success" || echo "failure"
RUN chown -R www:www /run/nginx
COPY --chown=www:www ./Frontend/src /www/src
USER www
CMD ["sh", "tools.sh"]