Skip to content

Commit

Permalink
dind
Browse files Browse the repository at this point in the history
  • Loading branch information
guilhermecgs committed Aug 11, 2024
1 parent 0dc6dc7 commit 35b253c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
22 changes: 10 additions & 12 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,24 @@ workflow:

variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
DOCKER_TLS_CERTDIR: "/certs"

cache:
paths:
- .cache/pip
- .cache/pip3
- venv/
services:
- docker:dind

stages:
- build
- coverage_report
- relatorio

# Stage to build the Docker image
# Stage to build the Docker image and push it to the registry
build:
stage: build
image: docker:stable
script:
- docker build -t chrome-with-selenium:latest .
artifacts:
paths:
- chrome-with-selenium.tar
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker build -t registry.gitlab.com/guilhermecgs/ir:latest .
- docker push registry.gitlab.com/guilhermecgs/ir:latest
when: always

before_script:
Expand All @@ -31,7 +29,7 @@ before_script:

coverage_html:
stage: coverage_report
image: chrome-with-selenium:latest
image: registry.gitlab.com/guilhermecgs/ir:latest
script:
- python3 coverage_test.py
- mkdir -p public/coverage_report
Expand All @@ -46,7 +44,7 @@ coverage_html:

relatorio:
stage: relatorio
image: chrome-with-selenium:latest
image: registry.gitlab.com/guilhermecgs/ir:latest
script:
- python3 ./ir.py --do check_environment_variables
# - python3 ./ir.py --do busca_trades_e_faz_merge_operacoes
Expand Down
13 changes: 11 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
FROM python:3.10

# Install system dependencies
RUN apt-get update && \
apt-get install -y wget unzip && \
apt-get clean

# install google chrome
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
RUN sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
Expand All @@ -17,8 +22,12 @@ ENV DISPLAY=:99
# upgrade pip
RUN pip3 install --upgrade pip

# Set working directory
WORKDIR /code

# Copy requirements and install
COPY ./requirements.txt /code/requirements.txt
RUN pip3 install --no-cache-dir --upgrade -r /code/requirements.txt

# install selenium
RUN pip3 install --no-cache-dir --upgrade -r /code/requirements.txt
# Copy the rest of the application code
COPY . /code

0 comments on commit 35b253c

Please sign in to comment.