Skip to content
Snippets Groups Projects
Commit a5174b68 authored by Daniel Göbel's avatar Daniel Göbel
Browse files

Merge branch 'feature/47-publish-docker-container' into 'development'

Resolve "Publish Docker container as part of gitlab pipeline"

Closes #47

See merge request cmg/clowm/clowm-s3proxy-service!43
parents e2ce2bb1 5d5af8c8
No related branches found
No related tags found
No related merge requests found
...@@ -11,7 +11,5 @@ README.md ...@@ -11,7 +11,5 @@ README.md
htmlcov htmlcov
app/tests app/tests
figures/ figures/
oidc_dev_example .gitlab-ci.yml
oidc_dev/ .coverage
traefik_dev
ceph
...@@ -31,15 +31,8 @@ default: ...@@ -31,15 +31,8 @@ default:
- python -m pip install --upgrade -r requirements-dev.txt - python -m pip install --upgrade -r requirements-dev.txt
stages: # List of stages for jobs, and their order of execution stages: # List of stages for jobs, and their order of execution
# - build
- test - test
# - deploy - deploy
#build-job: # This job runs in the build stage, which runs first.
# stage: build
# script:
# - echo "Compiling the code..."
# - echo "Compile complete."
integration-test-job: # Runs integration tests with the database integration-test-job: # Runs integration tests with the database
stage: test stage: test
...@@ -134,8 +127,36 @@ lint-test-job: # Runs linters checks on code ...@@ -134,8 +127,36 @@ lint-test-job: # Runs linters checks on code
script: script:
- ./scripts/lint.sh - ./scripts/lint.sh
#deploy-job: # This job runs in the deploy stage. build-publish-dev-docker-container-job:
# stage: deploy # It only runs when *both* jobs in the test stage complete successfully. stage: deploy
# script: image:
# - echo "Deploying application..." name: gcr.io/kaniko-project/executor:v1.9.1-debug
# - echo "Application successfully deployed." entrypoint: [""]
only:
refs:
- development
before_script:
- echo "{\"auths\":{\"${CI_REGISTRY}\":{\"auth\":\"$(printf "%s:%s" "${CI_REGISTRY_USER}" "${CI_REGISTRY_PASSWORD}" | base64 | tr -d '\n')\"},\"$CI_DEPENDENCY_PROXY_SERVER\":{\"auth\":\"$(printf "%s:%s" ${CI_DEPENDENCY_PROXY_USER} "${CI_DEPENDENCY_PROXY_PASSWORD}" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json
script:
- /kaniko/executor
--context "${CI_PROJECT_DIR}"
--dockerfile "${CI_PROJECT_DIR}/Dockerfile"
--destination "${CI_REGISTRY_IMAGE}:dev-${CI_COMMIT_SHA}"
build-publish-docker-container-job:
stage: deploy
image:
name: gcr.io/kaniko-project/executor:v1.9.1-debug
entrypoint: [""]
only:
- tags
before_script:
- echo "{\"auths\":{\"${CI_REGISTRY}\":{\"auth\":\"$(printf "%s:%s" "${CI_REGISTRY_USER}" "${CI_REGISTRY_PASSWORD}" | base64 | tr -d '\n')\"},\"$CI_DEPENDENCY_PROXY_SERVER\":{\"auth\":\"$(printf "%s:%s" ${CI_DEPENDENCY_PROXY_USER} "${CI_DEPENDENCY_PROXY_PASSWORD}" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json
script:
- /kaniko/executor
--context "${CI_PROJECT_DIR}"
--dockerfile "${CI_PROJECT_DIR}/Dockerfile"
--destination "${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}"
--destination "${CI_REGISTRY_IMAGE}:$(echo ${CI_COMMIT_TAG} | cut -d'.' -f1-2)"
--destination "${CI_REGISTRY_IMAGE}:$(echo ${CI_COMMIT_TAG} | cut -d'.' -f1)"
--destination "${CI_REGISTRY_IMAGE}:latest"
FROM python:3.10-slim FROM python:3.10-slim
WORKDIR /code EXPOSE 8000
ENV PYTHONPATH=/code
EXPOSE 80
# dumb-init forwards the kill signal to the python process # dumb-init forwards the kill signal to the python process
RUN apt-get update && apt-get -y install dumb-init curl RUN apt-get update && apt-get -y install dumb-init curl
ENTRYPOINT ["/usr/bin/dumb-init", "--"] ENTRYPOINT ["/usr/bin/dumb-init", "--"]
HEALTHCHECK --interval=35s --timeout=4s CMD curl -f http://localhost/health || exit 1 HEALTHCHECK --interval=35s --timeout=4s CMD curl -f http://localhost:8000/health || exit 1
COPY requirements.txt ./requirements.txt RUN useradd -m worker
USER worker
WORKDIR /home/worker/code
ENV PYTHONPATH=/home/worker/code
ENV PATH="/home/worker/.local/bin:${PATH}"
RUN pip install --no-cache-dir --upgrade -r requirements.txt COPY --chown=worker:worker requirements.txt ./requirements.txt
COPY . . RUN pip install --user --no-cache-dir --upgrade -r requirements.txt
COPY --chown=worker:worker . .
CMD ["./start_service.sh"] CMD ["./start_service.sh"]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment