Skip to content

Commit

Permalink
Docker Builds on Publish (#47)
Browse files Browse the repository at this point in the history
* add docker github action

* run versioning plugin in dockerfile - add dockerignore

* fix action syntax

* fix action syntax

* fix action syntax

* fix actions syntax

* fix actions syntax

* fix docker versioning

* tag image with version tag

* fix workflow syntax?

* fix workflow syntax?

* fix workflow syntax?

* change buildkit version for compatibility with broken docker on hpg1002

* downgrade moby iamge

* fix image reference

* try ubuntu 20.04

* disable pip progress bar

* bump buildkit version

* Update .github/workflows/docker.yaml

Co-authored-by: Fridolin Glatter <83776373+glatterf42@users.noreply.github.com>

* Update Dockerfile

Co-authored-by: Fridolin Glatter <83776373+glatterf42@users.noreply.github.com>

* update lock file

---------

Co-authored-by: Fridolin Glatter <83776373+glatterf42@users.noreply.github.com>
  • Loading branch information
meksor and glatterf42 committed Feb 13, 2024
1 parent bff2c8c commit 4b33dc6
Show file tree
Hide file tree
Showing 4 changed files with 317 additions and 116 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/tests/test-data
/dist
48 changes: 48 additions & 0 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: docker

on:
push:
tags: ["v*"]
release:
types: ["published"]

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: latest
driver-opts: "image=moby/buildkit:v0.10.5"
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: ene-docker.iiasa.ac.at
username: ixmp-server-workflow-build-user
password: ${{ secrets.NEXUS_PASSWORD }}
- name: Check out repository
uses: actions/checkout@v4
- name: Write release version
run: |
VERSION_TAG=${GITHUB_REF_NAME#v}
echo Docker Image Version: $VERSION_TAG
echo "VERSION_TAG=$VERSION_TAG" >> $GITHUB_ENV
- if: github.event_name == 'release'
name: Build and push latest
uses: docker/build-push-action@v5
with:
context: .
push: true
build-args: |
POETRY_OPTS=--with server
tags: ene-docker.iiasa.ac.at/ixmp4-server:latest,ene-docker.iiasa.ac.at/ixmp4-server:${{env.VERSION_TAG}}
- if: github.event_name != 'release'
name: Build and push dev
uses: docker/build-push-action@v5
with:
context: .
push: true
build-args: |
POETRY_OPTS=--with server
tags: ene-docker.iiasa.ac.at/ixmp4-server:dev,ene-docker.iiasa.ac.at/ixmp4-server:${{env.VERSION_TAG}}
9 changes: 6 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.10
FROM python:3.12

ARG POETRY_OPTS

Expand All @@ -15,6 +15,7 @@ ENV \

ENV \
PIP_NO_CACHE_DIR=off \
PIP_PROGRESS_BAR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100

Expand All @@ -32,9 +33,11 @@ WORKDIR /opt/ixmp4
RUN mkdir -p run/logs && \
touch .env

RUN poetry self add "poetry-dynamic-versioning[plugin]" && \
poetry dynamic-versioning
RUN poetry build --format wheel && \
poetry export ${POETRY_OPTS} --format requirements.txt --output constraints.txt --without-hashes && \
pip install ./dist/*.whl && \
poetry export ${POETRY_OPTS} --format requirements.txt --output constraints.txt --without-hashes
RUN pip install ./dist/*.whl && \
pip install -r constraints.txt


Expand Down
Loading

0 comments on commit 4b33dc6

Please sign in to comment.