Skip to content

Commit 2db3eec

Browse files
author
Rodolfo
committed
updating image for stage and prod
1 parent b0d0dc0 commit 2db3eec

File tree

3 files changed

+18
-20
lines changed

3 files changed

+18
-20
lines changed

.github/workflows/time-tracker-ui-cd-prod.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
- name: Build the docker image
3939
run: |-
4040
docker build \
41-
--target production -t timetracker_ui \
41+
--target production_prod -t timetracker_ui \
4242
.
4343
4444
- name: Publish docker image to prod azure container registry

.github/workflows/time-tracker-ui-cd-stage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
- name: Build the docker image
3939
run: |-
4040
docker build \
41-
--target production -t timetracker_ui \
41+
--target production_stage -t timetracker_ui \
4242
.
4343
4444
- name: Publish docker image to stage azure container registry

Dockerfile

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,26 @@
1-
FROM node:14-alpine AS building
1+
FROM node:14-alpine AS building_stage
22
WORKDIR /app
3-
# ENV USERNAME timetracker
4-
# ENV HOME /home/${USERNAME}
5-
# RUN useradd -ms /bin/bash ${USERNAME}
6-
# WORKDIR ${HOME}/time-tracker-ui
73
COPY . /app
8-
# RUN chown ${USERNAME}:${USERNAME} -R ${HOME}/time-tracker-ui
9-
# RUN chmod -R 777 ${HOME}/time-tracker-ui
10-
# USER ${USERNAME}
114
RUN npm cache clean --force && npm install
125
EXPOSE 4200 9876
136
RUN source .stage.env && npm run build
14-
# >> scrt &&
15-
#
167

17-
FROM nginx:1.21 AS production
8+
9+
FROM nginx:1.21 AS production_stage
1810
COPY nginx.conf /etc/nginx/conf.d/default.conf
19-
COPY --from=building /app/dist/time-tracker /usr/share/nginx/html
20-
# FIXME: Actually if we can deploy to azure in port 80 we need a root user
21-
# Maybe we can refactor this dockerfile to use root user directly this is not a good approach y
22-
# security terms. It's a good practice to have rootless in containers so for this
23-
# we can to refactor this dockerfile and the terraform module to deploy in other ports because
24-
# Ports below 1024 needs root permisions.
11+
COPY --from=building_stage /app/dist/time-tracker /usr/share/nginx/html
12+
EXPOSE 80
13+
14+
15+
FROM node:14-alpine AS building_prod
16+
WORKDIR /app
17+
COPY . /app
18+
RUN npm cache clean --force && npm install
19+
EXPOSE 4200 9876
20+
RUN source .prod.env && npm run build
2521

26-
# USER ${USERNAME}
2722

23+
FROM nginx:1.21 AS production_prod
24+
COPY nginx.conf /etc/nginx/conf.d/default.conf
25+
COPY --from=building_prod /app/dist/time-tracker /usr/share/nginx/html
2826
EXPOSE 80

0 commit comments

Comments
 (0)