Skip to content

Commit

Permalink
Merge pull request #40 from OpenGeoscience/publish-docker-images
Browse files Browse the repository at this point in the history
Publishing server code as Docker image
annehaley authored Jun 20, 2024
2 parents b371373 + 52ba359 commit bca73f4
Showing 3 changed files with 47 additions and 12 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Release
on:
workflow_dispatch:
push:
branches:
- master

env:
REGISTRY: ghcr.io
IMAGE_NAME: opengeoscience/uvdat-server

jobs:
tag-and-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Python Semantic Release
id: release
uses: python-semantic-release/python-semantic-release@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Log into the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: token
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push the Docker image
uses: docker/build-push-action@v3
with:
context: .
file: dev/Dockerfile
push: ${{ github.actor != 'dependabot[bot]' }}
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.release.outputs.tag }}
13 changes: 5 additions & 8 deletions dev/django.Dockerfile → dev/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
FROM python:3.10-slim
# Install system libraries for Python packages:
# * psycopg2
RUN apt-get update && \
apt-get install --no-install-recommends --yes \
libpq-dev libvips-dev gcc libc6-dev gdal-bin git && \
@@ -9,13 +8,11 @@ RUN apt-get update && \
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

# Only copy the setup.py, it will still force all install_requires to be installed,
# but find_packages() will find nothing (which is fine). When Docker Compose mounts the real source
# over top of this directory, the .egg-link in site-packages resolves to the mounted directory
# and all package modules are importable.
COPY ./setup.py /opt/django-project/setup.py
COPY ./setup.py /opt/uvdat-server/setup.py
COPY ./manage.py /opt/uvdat-server/manage.py
COPY ./uvdat /opt/uvdat-server/uvdat
RUN pip install large-image[gdal,pil] large-image-converter --find-links https://girder.github.io/large_image_wheels
RUN pip install --editable /opt/django-project[dev]
RUN pip install --editable /opt/uvdat-server[dev]

# Use a directory name which will never be an import name, as isort considers this as first-party.
WORKDIR /opt/django-project
WORKDIR /opt/uvdat-server
8 changes: 4 additions & 4 deletions docker-compose.override.yml
Original file line number Diff line number Diff line change
@@ -3,13 +3,13 @@ services:
django:
build:
context: .
dockerfile: ./dev/django.Dockerfile
dockerfile: ./dev/Dockerfile
command: [ "./manage.py", "runserver", "0.0.0.0:8000" ]
# Log printing via Rich is enhanced by a TTY
tty: true
env_file: ./dev/.env.docker-compose
volumes:
- .:/opt/django-project
- .:/opt/uvdat-server
ports:
- 8000:8000
depends_on:
@@ -20,7 +20,7 @@ services:
celery:
build:
context: .
dockerfile: ./dev/django.Dockerfile
dockerfile: ./dev/Dockerfile
command:
[
"celery",
@@ -35,7 +35,7 @@ services:
tty: false
env_file: ./dev/.env.docker-compose
volumes:
- .:/opt/django-project
- .:/opt/uvdat-server
depends_on:
- postgres
- rabbitmq

0 comments on commit bca73f4

Please sign in to comment.