|
1 | 1 | # syntax=docker/dockerfile:1.2
|
2 | 2 |
|
3 | 3 | FROM node:14 AS building
|
4 |
| - |
5 |
| -ENV USERNAME timetracker |
6 |
| -ENV HOME /home/${USERNAME} |
7 |
| -RUN useradd -ms /bin/bash ${USERNAME} |
8 |
| -WORKDIR ${HOME}/time-tracker-ui |
9 |
| -COPY . . |
10 |
| -RUN chown ${USERNAME}:${USERNAME} -R ${HOME}/time-tracker-ui |
11 |
| -RUN chmod -R 777 ${HOME}/time-tracker-ui |
12 |
| - |
13 |
| -USER ${USERNAME} |
| 4 | +WORKDIR /usr/local/app |
| 5 | +# ENV USERNAME timetracker |
| 6 | +# ENV HOME /home/${USERNAME} |
| 7 | +# RUN useradd -ms /bin/bash ${USERNAME} |
| 8 | +# WORKDIR ${HOME}/time-tracker-ui |
| 9 | +COPY . /usr/local/app/ |
| 10 | +# RUN chown ${USERNAME}:${USERNAME} -R ${HOME}/time-tracker-ui |
| 11 | +# RUN chmod -R 777 ${HOME}/time-tracker-ui |
| 12 | +# USER ${USERNAME} |
14 | 13 | RUN npm cache clean --force && npm install
|
15 | 14 | EXPOSE 4200
|
16 | 15 | EXPOSE 9876
|
17 |
| -RUN --mount=type=secret,id=mysecret,dst=/secrets ls -l |
18 |
| -RUN --mount=type=secret,id=mysecret,dst=/secrets eval "$(echo $(cat /secrets))" && npm run build |
19 |
| - |
| 16 | +RUN --mount=type=secret,id=mysecret,dst=/foobar eval "$(echo $(cat /foobar))" && npm run build |
| 17 | +# >> scrt && |
| 18 | +# |
20 | 19 |
|
21 | 20 | FROM nginx:1.21 AS production
|
22 | 21 |
|
23 |
| -ENV USERNAME app |
24 |
| -RUN useradd -ms /bin/bash ${USERNAME} |
25 |
| - |
26 |
| -COPY nginx.conf /etc/nginx/conf.d/default.conf |
27 |
| -COPY --from=building /home/timetracker/time-tracker-ui/dist/time-tracker /usr/share/nginx/html |
28 |
| -RUN chown -R ${USERNAME}:${USERNAME} /var/cache/nginx && \ |
29 |
| - chown -R ${USERNAME}:${USERNAME} /var/log/nginx && \ |
30 |
| - chown -R ${USERNAME}:${USERNAME} /etc/nginx/conf.d |
31 |
| -RUN touch /var/run/nginx.pid && chown -R ${USERNAME}:${USERNAME} /var/run/nginx.pid |
| 22 | +COPY --from=building /usr/local/app/dist/time-tracker /usr/share/nginx/html |
32 | 23 |
|
33 | 24 | # FIXME: Actually if we can deploy to azure in port 80 we need a root user
|
34 | 25 | # Maybe we can refactor this dockerfile to use root user directly this is not a good approach y
|
|
0 commit comments