diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 988df2788911128c1668ad27e3f9f3f11fd60b97..d97b2ae9b64363dd5c7e7303d6545035372a709a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,7 +15,7 @@ variables: DBPROJECT_USER: postgres DBPROJECT_PASSWORD: postgres DOMAIN: localhost - ESAP_DB_IMAGE: ${CI_REGISTRY_IMAGE}:latest + ESAP_DB_IMAGE: ${CI_REGISTRY_IMAGE} before_script: - docker version @@ -36,7 +36,9 @@ build: - docker-compose -f host-files/docker-compose.yml config > host-files/docker-stack.yml - docker-compose -f host-files/docker-stack.yml build - echo ${CI_JOB_TOKEN} | docker login -u "${CI_REGISTRY_USER}" --password-stdin "${CI_REGISTRY}" - - docker push ${ESAP_DB_IMAGE} + - docker tag ${ESAP_DB_IMAGE}:latest ${ESAP_DB_IMAGE}:${CI_COMMIT_BRANCH}-${CI_COMMIT_SHORT_SHA} + - docker push ${ESAP_DB_IMAGE}:latest + - docker push ${ESAP_DB_IMAGE}:${CI_COMMIT_BRANCH}-${CI_COMMIT_SHORT_SHA} test-functional: stage: test diff --git a/Dockerfile b/Dockerfile index a6e714b124186103584ec31e593e8f5a45e63246..8d32942f42a6cc9068511ed4d183052e528a8762 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Pull base image -FROM python:3.9 +FROM python:3.9-slim # Set environment varibles ENV PYTHONDONTWRITEBYTECODE 1 @@ -8,10 +8,11 @@ ENV PYTHONUNBUFFERED 1 WORKDIR /code/ # Install Poetry -RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | POETRY_HOME=/opt/poetry python && \ - cd /usr/local/bin && \ - ln -s /opt/poetry/bin/poetry && \ - poetry config virtualenvs.create false +RUN apt-get update && apt-get install -y curl libpq-dev gcc +RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | POETRY_HOME=/opt/poetry python \ + && cd /usr/local/bin \ + && ln -s /opt/poetry/bin/poetry \ + && poetry config virtualenvs.create false # Copy poetry.lock* in case it doesn't exist in the repo COPY ./pyproject.toml ./poetry.lock* /code/ diff --git a/host-files/docker-compose.yml b/host-files/docker-compose.yml index a32af31049065aef4f638c4f67dfc0bd50afb666..159b492d2ce4f8f38be425557b4f5239400a8c7b 100644 --- a/host-files/docker-compose.yml +++ b/host-files/docker-compose.yml @@ -3,7 +3,7 @@ version: "3" services: esap-db: - image: ${ESAP_DB_IMAGE:-esap-db:latest} + image: ${ESAP_DB_IMAGE:-esap-db}:latest container_name: esap-db stdin_open: true # docker run -i tty: true # docker run -t