Skip to content

Commit 4f78988

Browse files
committed
docker buildkit
1 parent 9f8f2f3 commit 4f78988

File tree

1 file changed

+13
-22
lines changed

1 file changed

+13
-22
lines changed

Dockerfile

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,25 @@
11
# syntax=docker/dockerfile:1.2
22

33
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}
1413
RUN npm cache clean --force && npm install
1514
EXPOSE 4200
1615
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+
#
2019

2120
FROM nginx:1.21 AS production
2221

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
3223

3324
# FIXME: Actually if we can deploy to azure in port 80 we need a root user
3425
# Maybe we can refactor this dockerfile to use root user directly this is not a good approach y

0 commit comments

Comments
 (0)