Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker Builds on Publish #47

Merged
merged 22 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading