From 49780739f813192b45098d8ba911797c2155479e Mon Sep 17 00:00:00 2001 From: Oliver Falk Date: Fri, 28 Oct 2022 14:06:56 +0200 Subject: [PATCH 1/4] Add Dockerfile and build image from it --- Dockerfile | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..06c113e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +# Dockerfile for libravatar + +FROM quay.io/rhn_support_ofalk/fedora35-python3 +LABEL maintainer Oliver Falk +EXPOSE 8081 + +RUN pip3 install pip --upgrade + +ADD . /opt/ivatar-devel + +WORKDIR /opt/ivatar-devel + +RUN pip3 install Pillow && pip3 install -r requirements.txt && pip3 install python-coveralls coverage pycco django_coverage_plugin + +RUN echo "DEBUG = True" >> /opt/ivatar-devel/config_local.py +RUN echo "EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'" >> /opt/ivatar-devel/config_local.py +RUN python3 manage.py migrate && python3 manage.py collectstatic --noinput +RUN echo "from django.contrib.auth import get_user_model; User = get_user_model(); User.objects.create_superuser('admin', 'admin@local.tld', 'admin')" | python manage.py shell +ENTRYPOINT python3 ./manage.py runserver 0:8081 From e1923f92c2ca87f1656245137c5c6e195efa0815 Mon Sep 17 00:00:00 2001 From: Oliver Falk Date: Fri, 28 Oct 2022 14:07:24 +0200 Subject: [PATCH 2/4] Add Dockerfile and build image from it --- .gitlab-ci.yml | 31 ++++++++++++++++++++++++++++--- Dockerfile | 2 -- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8289677..48fe253 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,7 @@ -image: - name: quay.io/rhn_support_ofalk/fedora35-python3 - entrypoint: [ '/bin/sh', '-c' ] +default: + image: + name: quay.io/rhn_support_ofalk/fedora35-python3 + entrypoint: [ '/bin/sh', '-c' ] before_script: - virtualenv -p python3 /tmp/.virtualenv @@ -54,3 +55,27 @@ pages: expire_in: 14 days only: - master + +build-image: + image: docker + services: + - docker:dind + before_script: + - docker info + - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY + + script: + - ls -lah + - docker build . -t fedora36-python3 + - docker run fedora36-python3 python -V + - docker run fedora36-python3 cat /etc/fedora-release + - | + if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then + tag="" + echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'" + else + tag=":$CI_COMMIT_REF_SLUG" + echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag" + fi + - docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" . + - docker push "$CI_REGISTRY_IMAGE${tag}" diff --git a/Dockerfile b/Dockerfile index 06c113e..6927672 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,3 @@ -# Dockerfile for libravatar - FROM quay.io/rhn_support_ofalk/fedora35-python3 LABEL maintainer Oliver Falk EXPOSE 8081 From f4fe49b3b478a4c964272464de1c190a51187a24 Mon Sep 17 00:00:00 2001 From: Oliver Falk Date: Fri, 28 Oct 2022 14:20:57 +0200 Subject: [PATCH 3/4] Oops, we shouldn't run it --- .gitlab-ci.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 48fe253..db7d237 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -66,9 +66,6 @@ build-image: script: - ls -lah - - docker build . -t fedora36-python3 - - docker run fedora36-python3 python -V - - docker run fedora36-python3 cat /etc/fedora-release - | if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then tag="" From 1aa40fecab8f5f17d776bbd3f000e1681322abb3 Mon Sep 17 00:00:00 2001 From: Oliver Falk Date: Fri, 28 Oct 2022 14:59:20 +0200 Subject: [PATCH 4/4] Ignore a few more files --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index f2a6929..afcc9a4 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,6 @@ locale/*/LC_MESSAGES/django.mo .idea/ contacts.csv falko_gravatar.jpg +*.egg-info +dump_all*.sql +dist/