Skip to content

Commit

Permalink
Merge pull request #100 from wavespectra/docker
Browse files Browse the repository at this point in the history
Docker build
  • Loading branch information
tomdurrant committed Dec 1, 2023
2 parents d9403de + 0104171 commit 45a6906
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 3 deletions.
40 changes: 37 additions & 3 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
name: Upload Python Package
name: Python Packaging and docker build

on:
release:
types: [published]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

permissions:
contents: read
packages: write

jobs:
deploy:
pypi-release:
runs-on: ubuntu-latest
steps:
-
name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4
-
name: Set up Python
uses: actions/setup-python@v3
Expand All @@ -40,3 +45,32 @@ jobs:
with:
password: ${{ secrets.PYPI_API_TOKEN }}
verbose: true

docker-publish:
runs-on: ubuntu-latest
needs: pypi-release
steps:
-
name: Checkout repository
uses: actions/checkout@v4
-
name: Login to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
-
name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM ubuntu:22.04

LABEL maintainer "Rafael Guedes <r.guedes@oceanum.science>"
LABEL org.opencontainers.image.source=https://github.com/wavespectra/wavespectra

RUN echo "--------------- Installing system libraries ---------------" && \
apt update && apt upgrade -y && \
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt -y install \
gfortran \
python3-pip && \
apt clean all

RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1

RUN echo "-------------------- Installing wavespectra --------------------" && \
pip install ipython wavespectra[extra]

RUN pip install ipython

0 comments on commit 45a6906

Please sign in to comment.