Skip to content
Prev Previous commit
Next Next commit
Modify the name of the test image and delete the prod service in the …
…docker-compose.yml file
  • Loading branch information
sbateca committed May 12, 2022
commit 455945c48207216fcd0833d28f6cdff676d3d696
7 changes: 2 additions & 5 deletions Docker/dev.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@ RUN useradd -ms /bin/bash ${USERNAME}

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

USER ${USERNAME}
RUN npm cache clean --force && npm install
EXPOSE 4200
EXPOSE 9876
CMD npm run config && ${HOME}/time-tracker-ui/node_modules/.bin/ng serve --host 0.0.0.0 --disableHostCheck
19 changes: 9 additions & 10 deletions Docker/test.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
FROM node:14 AS development
FROM node:14

ARG CHROME_VERSION=101.0.4951.54
ARG CHROME_DRIVER_VERSION=2.37
ENV USERNAME timetracker
ENV HOME /home/${USERNAME}
ENV CHROME_BIN /opt/google/chrome/google-chrome

#Essential tools and xvfb
RUN apt-get update && apt-get install -y \
software-properties-common \
Expand All @@ -12,7 +15,6 @@ RUN apt-get update && apt-get install -y \
xvfb

#Chrome browser to run the tests
ARG CHROME_VERSION=65.0.3325.181
RUN curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add \
&& wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
&& dpkg -i google-chrome-stable_current_amd64.deb || true
Expand All @@ -25,7 +27,6 @@ RUN dpkg-divert --add --rename --divert /opt/google/chrome/google-chrome.real /o
&& chmod 755 /opt/google/chrome/google-chrome

#Chrome Driver
ARG CHROME_DRIVER_VERSION=2.37
RUN mkdir -p /opt/selenium \
&& curl http://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip -o /opt/selenium/chromedriver_linux64.zip \
&& cd /opt/selenium; unzip /opt/selenium/chromedriver_linux64.zip; rm -rf chromedriver_linux64.zip; ln -fs /opt/selenium/chromedriver /usr/local/bin/chromedriver;
Expand All @@ -34,15 +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}
RUN npm cache clean --force && npm install
# COPY .env .
RUN npm cache clean --force && npm install \
&& npm run config && npm run test
EXPOSE 4200
EXPOSE 9876

FROM development as build
COPY .env .
RUN npm run config && npm run test
EXPOSE 9876
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ remove: ## Delete container timetracker_ui.
.PHONY: test
test: ## Run all tests on docker container timetracker_ui at the CLI.
docker-compose up -d timetracker_ui_test
docker exec timetracker_ui bash -c "npm run ci-test"
docker exec timetracker_ui_test bash -c "npm run ci-test"

.PHONY: testdev
testdev: ## Run all tests on docker container timetracker_ui at the Dev
Expand Down
29 changes: 2 additions & 27 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ services:
- 4200:4200
- 9876:9876
environment:
CHROME_BIN: /opt/google/chrome/google-chrome
AUTHORITY: ${AUTHORITY}
CLIENT_ID: ${CLIENT_ID}
SCOPES: ${SCOPES}
Expand All @@ -20,37 +19,13 @@ services:
AUTHORITY_JSON: ${AUTHORITY_JSON}
CLIENT_ID_JSON: ${CLIENT_ID_JSON}
SCOPES_JSON: ${SCOPES_JSON}


timetracker_ui_prod:
container_name: timetracker_ui_prod
image: timetracker_ui_prod
build:
context: .
dockerfile: ./Docker/prod.Dockerfile
ports:
- 4200:4200
- 9876:9876
environment:
CHROME_BIN: /opt/google/chrome/google-chrome
AUTHORITY: ${AUTHORITY}
CLIENT_ID: ${CLIENT_ID}
SCOPES: ${SCOPES}
STACK_EXCHANGE_ID: ${STACK_EXCHANGE_ID}
STACK_EXCHANGE_ACCESS_TOKEN: ${STACK_EXCHANGE_ACCESS_TOKEN}
AZURE_APP_CONFIGURATION_CONNECTION_STRING: ${AZURE_APP_CONFIGURATION_CONNECTION_STRING}
AUTHORITY_JSON: ${AUTHORITY_JSON}
CLIENT_ID_JSON: ${CLIENT_ID_JSON}
SCOPES_JSON: ${SCOPES_JSON}

timetracker_ui_test:
container_name: timetracker_ui
image: timetracker_ui
container_name: timetracker_ui_test
image: timetracker_ui_test
build:
context: .
dockerfile: ./Docker/test.Dockerfile
environment:
CHROME_BIN: /opt/google/chrome/google-chrome
AUTHORITY: ${AUTHORITY}
CLIENT_ID: ${CLIENT_ID}
SCOPES: ${SCOPES}
Expand Down