-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathDockerfile
55 lines (37 loc) · 1.07 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
54
55
# FROM node:16-alpine as builder
# WORKDIR /home/gram
# ADD app .
# Build the react app
FROM node:20-alpine
WORKDIR /home/gram
USER root
RUN mkdir assets
ADD package.json .
ADD package-lock.json .
ADD lerna.json .
ADD tsconfig.json .
ADD tsconfig.build.json .
ADD api api
ADD app app
ADD core core
ADD config config
ADD plugins plugins
# This value is not secret and accessible in the frontend.
# ENV REACT_APP_SENTRY_DSN=""
RUN npm i --loglevel=warn --no-progress
RUN npm run build
# COPY --from=builder
RUN cp -r /home/gram/app/build ./frontend/
# Remove dev dependencies (needed typescript and types to build)
RUN npm prune --omit=dev
# gram user needs write access to the assets folder in order to set up the symlinks
# however when we use ADD all files are owned by root and not writeable by anyone but root, so we need to
# swap here briefly to root to fix the permissions.
# USER root
RUN addgroup -S gram && adduser -S gram -G gram
RUN cp api/assets/* assets/
RUN chown gram:gram assets
# drop back to gram
USER gram
EXPOSE 8080 8081
CMD ["npm", "run", "docker-start"]