-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
44 lines (37 loc) · 1.32 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
FROM node:22.5.1-alpine
############################################
# General Docker image configuration
############################################
WORKDIR /srv/app
EXPOSE 3000
CMD [ "npm", "run", "serve" ]
ENTRYPOINT [ "./entrypoint.sh" ]
############################################
# System Dependencies
############################################
RUN apk update && apk add --no-cache gettext dos2unix
############################################
# None root user
############################################
RUN chown -R node:node /srv/app
USER node
COPY --chown=node:node [ "package.json", "package-lock.json", "vite.config.ts", "tsconfig.json", "index.html", "404.html", "./"]
COPY --chown=node:node [ "./docker/entrypoint.sh", "./entrypoint.sh"]
COPY --chown=node:node [ "public", "public"]
COPY --chown=node:node [ "src", "src"]
############################################
# Building Application
############################################
ENV REACT_APP_PUBLIC_URL=/
RUN sed -i "s|base: '/thilo/',|base: '/',|g" vite.config.ts
RUN npm install
RUN export NODE_OPTIONS=--openssl-legacy-provider && npm run build
# Create backend export
RUN node src/scripts/strapiToJson.js
RUN mv exports build/exports
RUN chmod +x entrypoint.sh
RUN dos2unix entrypoint.sh
USER root
RUN chgrp -R 0 /srv/app && \
chmod -R g=u /srv/app
USER node