Skip to content
Prev Previous commit
Next Next commit
Modify the dockerfile and docker-compose to generate an image for tes…
…ting
  • Loading branch information
sbateca committed May 12, 2022
commit 9a987495e41ff045f6daa98b0354cee196dda4c4
12 changes: 6 additions & 6 deletions Docker/test.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM node:14

ARG CHROME_VERSION=101.0.4951.54
ARG CHROME_VERSION=65.0.3325.181
ARG CHROME_DRIVER_VERSION=2.37
ENV USERNAME timetracker
ENV HOME /home/${USERNAME}
Expand Down Expand Up @@ -35,13 +35,13 @@ RUN useradd -ms /bin/bash ${USERNAME}

WORKDIR ${HOME}/time-tracker-ui
COPY . .
# RUN rm -f .env
RUN rm -f .env
RUN chown ${USERNAME}:${USERNAME} -R ${HOME}/time-tracker-ui
RUN chmod -R 777 ${HOME}/time-tracker-ui

USER ${USERNAME}
# COPY .env .
RUN npm cache clean --force && npm install \
&& npm run config && npm run test
COPY .env .
EXPOSE 4200
EXPOSE 9876
EXPOSE 9876
RUN npm cache clean --force && npm install
CMD npm run config && npm run ci-test
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ remove: ## Delete container timetracker_ui.

.PHONY: test
test: ## Run all tests on docker container timetracker_ui at the CLI.
docker-compose build timetracker_ui_test
docker-compose up -d timetracker_ui_test
docker exec timetracker_ui_test bash -c "npm run ci-test"
docker logs -f timetracker_ui_test

.PHONY: testdev
testdev: ## Run all tests on docker container timetracker_ui at the Dev
Expand Down
4 changes: 4 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ services:
build:
context: .
dockerfile: ./Docker/test.Dockerfile
ports:
- 4200:4200
- 9876:9876
environment:
CHROME_BIN: /opt/google/chrome/google-chrome
AUTHORITY: ${AUTHORITY}
CLIENT_ID: ${CLIENT_ID}
SCOPES: ${SCOPES}
Expand Down