From 5cb605b6be4c7a1f5cd1c1a77c3fba52ffc206c0 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Tue, 27 Jul 2021 22:51:52 +0200 Subject: [PATCH] Docker build --- .gitlab-ci.yml | 25 ++++++++++++++++++++----- Dockerfile | 8 ++++++++ 2 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 Dockerfile diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 97eace2..c5a805a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,22 @@ -latest: - image: python:3.9.5-slim +stages: + - build + - test + - deploy + +variables: + # disable Docker TLS validation + DOCKER_TLS_CERTDIR: "" + # localhost address is shared by both the job container and the dind container (as they share the same Pod) + # So this configuration make the dind service as our Docker daemon when running Docker commands + DOCKER_HOST: "tcp://localhost:2375" + +services: + - docker:stable-dind + +docker-build: + image: docker:stable stage: build script: - - pip install -r requirements.txt - - cd src - - python main.py \ No newline at end of file + - docker build + - docker tag registry.gitlab.com/ConfrerieDuKassoulait/TwitchBot:${CI_COMMIT_SHORT_SHA} + - docker push registry.gitlab.com/ConfrerieDuKassoulait/TwitchBot:${CI_COMMIT_SHORT_SHA} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..47f84c0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM python:3.9.5-slim + +COPY requirements.txt . +RUN pip install -r requirements.txt + +COPY src . + +CMD [ "python", "-u", "./main.py" ]