Skip to content

Commit 9a98749

Browse files
committed
Modify the dockerfile and docker-compose to generate an image for testing
1 parent 455945c commit 9a98749

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

Docker/test.Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM node:14
22

3-
ARG CHROME_VERSION=101.0.4951.54
3+
ARG CHROME_VERSION=65.0.3325.181
44
ARG CHROME_DRIVER_VERSION=2.37
55
ENV USERNAME timetracker
66
ENV HOME /home/${USERNAME}
@@ -35,13 +35,13 @@ RUN useradd -ms /bin/bash ${USERNAME}
3535

3636
WORKDIR ${HOME}/time-tracker-ui
3737
COPY . .
38-
# RUN rm -f .env
38+
RUN rm -f .env
3939
RUN chown ${USERNAME}:${USERNAME} -R ${HOME}/time-tracker-ui
4040
RUN chmod -R 777 ${HOME}/time-tracker-ui
4141

4242
USER ${USERNAME}
43-
# COPY .env .
44-
RUN npm cache clean --force && npm install \
45-
&& npm run config && npm run test
43+
COPY .env .
4644
EXPOSE 4200
47-
EXPOSE 9876
45+
EXPOSE 9876
46+
RUN npm cache clean --force && npm install
47+
CMD npm run config && npm run ci-test

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ remove: ## Delete container timetracker_ui.
4040

4141
.PHONY: test
4242
test: ## Run all tests on docker container timetracker_ui at the CLI.
43+
docker-compose build timetracker_ui_test
4344
docker-compose up -d timetracker_ui_test
44-
docker exec timetracker_ui_test bash -c "npm run ci-test"
45+
docker logs -f timetracker_ui_test
4546

4647
.PHONY: testdev
4748
testdev: ## Run all tests on docker container timetracker_ui at the Dev

docker-compose.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ services:
2525
build:
2626
context: .
2727
dockerfile: ./Docker/test.Dockerfile
28+
ports:
29+
- 4200:4200
30+
- 9876:9876
2831
environment:
32+
CHROME_BIN: /opt/google/chrome/google-chrome
2933
AUTHORITY: ${AUTHORITY}
3034
CLIENT_ID: ${CLIENT_ID}
3135
SCOPES: ${SCOPES}

0 commit comments

Comments
 (0)