Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
updating image for stage and prod
  • Loading branch information
Rodolfo committed Aug 20, 2022
commit 2db3eec03d5d9104035a6c166db42c0e6a495ca5
2 changes: 1 addition & 1 deletion .github/workflows/time-tracker-ui-cd-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Build the docker image
run: |-
docker build \
--target production -t timetracker_ui \
--target production_prod -t timetracker_ui \
.

- name: Publish docker image to prod azure container registry
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/time-tracker-ui-cd-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Build the docker image
run: |-
docker build \
--target production -t timetracker_ui \
--target production_stage -t timetracker_ui \
.

- name: Publish docker image to stage azure container registry
Expand Down
34 changes: 16 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
FROM node:14-alpine AS building
FROM node:14-alpine AS building_stage
WORKDIR /app
# ENV USERNAME timetracker
# ENV HOME /home/${USERNAME}
# RUN useradd -ms /bin/bash ${USERNAME}
# WORKDIR ${HOME}/time-tracker-ui
COPY . /app
# RUN chown ${USERNAME}:${USERNAME} -R ${HOME}/time-tracker-ui
# RUN chmod -R 777 ${HOME}/time-tracker-ui
# USER ${USERNAME}
RUN npm cache clean --force && npm install
EXPOSE 4200 9876
RUN source .stage.env && npm run build
# >> scrt &&
#

FROM nginx:1.21 AS production

FROM nginx:1.21 AS production_stage
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=building /app/dist/time-tracker /usr/share/nginx/html
# FIXME: Actually if we can deploy to azure in port 80 we need a root user
# Maybe we can refactor this dockerfile to use root user directly this is not a good approach y
# security terms. It's a good practice to have rootless in containers so for this
# we can to refactor this dockerfile and the terraform module to deploy in other ports because
# Ports below 1024 needs root permisions.
COPY --from=building_stage /app/dist/time-tracker /usr/share/nginx/html
EXPOSE 80


FROM node:14-alpine AS building_prod
WORKDIR /app
COPY . /app
RUN npm cache clean --force && npm install
EXPOSE 4200 9876
RUN source .prod.env && npm run build

# USER ${USERNAME}

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