Commit 83422500 authored by George Papathanail's avatar George Papathanail
Browse files

Add baseline CI pipeline and Docker build validation

parent dad03504
Loading
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ test:
  script:
    - pytest || [ $? -eq 5 ]

build:
build_test_image:
  stage: build
  tags:
    - shell
@@ -63,16 +63,16 @@ build:
    - docker info
  script:
    - export TEST_IMAGE_TAG="ci-${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA}"
    - env | grep -i proxy || true
    - curl -I https://pypi.org
    - docker build -t "$CI_REGISTRY_IMAGE:$TEST_IMAGE_TAG" .
    - docker build --network=host -t "$CI_REGISTRY_IMAGE:$TEST_IMAGE_TAG" .
  rules:
    - if: '$CI_COMMIT_BRANCH == "add-oeg-baseline-ci"'
    - if: '$CI_COMMIT_BRANCH'

push:
push_test_image:
  stage: push
  tags:
    - shell
  needs:
    - build_test_image
  before_script:
    - docker info
  script:
@@ -81,4 +81,4 @@ push:
    - docker push "$CI_REGISTRY_IMAGE:$TEST_IMAGE_TAG"
    - docker logout "$CI_REGISTRY"
  rules:
    - if: '$CI_COMMIT_BRANCH == "add-oeg-baseline-ci"'
 No newline at end of file
    - if: '$CI_COMMIT_BRANCH'
 No newline at end of file
+29 −6
Original line number Diff line number Diff line
@@ -5,19 +5,42 @@ WORKDIR /app
# DB build arg: base | postgres | mongo
ARG DB=base

ENV PIP_DEFAULT_TIMEOUT=120

COPY pyproject.toml ./
COPY README.md ./
COPY open_exposure_gateway/ ./open_exposure_gateway/

RUN python -m venv .venv && \
    .venv/bin/pip install --upgrade pip setuptools wheel && \
    .venv/bin/pip install \
      --no-cache-dir \
      --default-timeout=120 \
      --trusted-host pypi.org \
      --trusted-host files.pythonhosted.org \
      --upgrade pip setuptools wheel && \
    if [ "$DB" = "postgres" ]; then \
        .venv/bin/pip install ".[postgres]"; \
        .venv/bin/pip install \
          --no-cache-dir \
          --default-timeout=120 \
          --trusted-host pypi.org \
          --trusted-host files.pythonhosted.org \
          ".[postgres]"; \
    elif [ "$DB" = "mongo" ]; then \
        .venv/bin/pip install ".[mongo]"; \
        .venv/bin/pip install \
          --no-cache-dir \
          --default-timeout=120 \
          --trusted-host pypi.org \
          --trusted-host files.pythonhosted.org \
          ".[mongo]"; \
    else \
        .venv/bin/pip install "."; \
        .venv/bin/pip install \
          --no-cache-dir \
          --default-timeout=120 \
          --trusted-host pypi.org \
          --trusted-host files.pythonhosted.org \
          "."; \
    fi


FROM python:3.12-slim AS runtime

WORKDIR /app