Skip to content

Commit

Permalink
Add automated Docker image builds
Browse files Browse the repository at this point in the history
  • Loading branch information
mfisher87 committed May 25, 2024
1 parent fbfa06d commit 4d5b56e
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/publish-docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: "Build and publish container image"

on:
workflow_dispatch:
push:
branches:
- "main"
tags:
- "[0-9]+.[0-9]+.[0-9]+*"


env:
REGISTRY: "ghcr.io"
IMAGE_NAME: "${{ github.repository_owner }}/pdgraster"
IMAGE_TAG: "${{ github.ref_type == 'tag' && github.ref_name || 'latest' }}"


jobs:

build-and-release-image:
name: "Build and release container image"
runs-on: "ubuntu-latest"

permissions:
packages: "write"
attestations: "write"

steps:
- name: "Check out repository"
uses: "actions/checkout@v3"

- name: "Build container image"
run: |
docker build --tag "${REGISTRY}/${IMAGE_NAME}:${IMAGE_TAG}" .
- name: "GHCR login"
uses: "docker/login-action@v2"
with:
registry: "${{ env.REGISTRY }}"
username: "${{ github.repository_owner }}"
password: "${{ secrets.GITHUB_TOKEN }}"

- name: "Push to GHCR"
run: |
docker push "${REGISTRY}/${IMAGE_NAME}:${IMAGE_TAG}"
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM python:3.10-slim

# Install transitive dependencies
RUN apt-get update \
&& apt-get install -y git libspatialindex-dev libgdal-dev libproj-dev

# Install pdgraster from GitHub repo
RUN pip install git+https://github.com/PermafrostDiscoveryGateway/viz-raster.git

WORKDIR /app

CMD ["python3"]

0 comments on commit 4d5b56e

Please sign in to comment.