Skip to content

Commit f7fce33

Browse files
committed
stage changes
1 parent 082e887 commit f7fce33

File tree

4 files changed

+39
-13
lines changed

4 files changed

+39
-13
lines changed

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,16 @@ jobs:
3030
creds: ${{ secrets.AZURE_CREDENTIALS }}
3131

3232
- name: Build the docker image
33-
run: make build_prod
33+
run: |-
34+
docker build \
35+
--target production -t timetracker_ui \
36+
--build-arg API_URL="${{secrets.API_URL_STAGE}}" \
37+
--build-arg AUTHORITY="${{secrets.AUTHORITY}}" \
38+
--build-arg CLIENT_ID="${{secrets.CLIENT_ID_STAGE}}" \
39+
--build-arg CLIENT_URL="${{ secrets.CLIENT_URL_STAGE}}" \
40+
--build-arg SCOPES="${{secrets.SCOPES}}" \
41+
--build-arg AZURE_APP_CONFIGURATION_CONNECTION_STRING="${{secrets.AZURE_APP_CONFIGURATION_CONNECTION_STRING}}" \
42+
.
3443
3544
- name: Publish docker image to stage azure container registry
3645
run: |

Dockerfile

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:14 AS development
1+
FROM node:14 AS building
22

33
ENV USERNAME timetracker
44
ENV HOME /home/${USERNAME}
@@ -12,21 +12,30 @@ USER ${USERNAME}
1212
RUN npm cache clean --force && npm install
1313
EXPOSE 4200
1414
EXPOSE 9876
15-
CMD ${HOME}/time-tracker-ui/node_modules/.bin/ng serve --host 0.0.0.0 --disableHostCheck
15+
ARG API_URL
16+
ARG AUTHORITY
17+
ARG CLIENT_ID
18+
ARG CLIENT_URL
19+
ARG SCOPES
20+
ARG AZURE_APP_CONFIGURATION_CONNECTION_STRING
21+
22+
RUN API_URL=${API_URL} \
23+
AUTHORITY=${AUTHORITY} \
24+
CLIENT_ID=${CLIENT_ID} \
25+
CLIENT_URL=${CLIENT_URL} \
26+
SCOPES=${SCOPES} \
27+
AZURE_APP_CONFIGURATION_CONNECTION_STRING=${AZURE_APP_CONFIGURATION_CONNECTION_STRING}
1628

17-
18-
19-
FROM development as build
20-
COPY .env .
2129
RUN npm run build
2230

31+
2332
FROM nginx:1.21 AS production
2433

2534
ENV USERNAME app
2635
RUN useradd -ms /bin/bash ${USERNAME}
2736

2837
COPY nginx.conf /etc/nginx/conf.d/default.conf
29-
COPY --from=build /home/timetracker/time-tracker-ui/dist/time-tracker /usr/share/nginx/html
38+
COPY --from=building /home/timetracker/time-tracker-ui/dist/time-tracker /usr/share/nginx/html
3039
COPY .env /usr/share/nginx/html
3140
RUN chown -R ${USERNAME}:${USERNAME} /var/cache/nginx && \
3241
chown -R ${USERNAME}:${USERNAME} /var/log/nginx && \

Makefile

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,20 @@ publish: require-acr-arg require-image_tag-arg ## Upload a docker image to the s
5555
docker push $(acr).azurecr.io/timetracker_ui:$(image_tag)
5656

5757
.PHONY: build_prod
58-
build_prod: ## Create docker image with dependencies needed for production.
59-
docker build --target production -t timetracker_ui_prod -f Dockerfile .
58+
build_prod: ## Create docker image with dependencies needed for production -- to test locally only
59+
docker build \
60+
--target production -t timetracker_ui_prod \
61+
--build-arg API_URL="${API_URL}" \
62+
--build-arg AUTHORITY="${AUTHORITY}" \
63+
--build-arg CLIENT_ID="${CLIENT_ID}" \
64+
--build-arg CLIENT_URL="${CLIENT_URL}" \
65+
--build-arg SCOPES="${SCOPES}" \
66+
--build-arg AZURE_APP_CONFIGURATION_CONNECTION_STRING="${AZURE_APP_CONFIGURATION_CONNECTION_STRING}" \
67+
.
6068

6169
.PHONY: run_prod
62-
run_prod: ## Execute timetracker_ui_prod docker container.
63-
docker run -d -p 80:80 --env-file ./.env --name timetracker_ui_prod timetracker_ui_prod
70+
run_prod: ## Execute timetracker_ui_prod docker container -- to test locally only
71+
docker run -d -p 80:80 --name timetracker_ui_prod timetracker_ui_prod
6472

6573
.PHONY: stop_prod
6674
stop_prod: ## Stop container timetracker_ui_prod.

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)