From 0a8b82d1a36924c5f39b3bbd4cc2eeb1666f6ae5 Mon Sep 17 00:00:00 2001 From: "S. Andrew Sheppard" Date: Mon, 13 Nov 2023 16:17:20 -0500 Subject: [PATCH] initial version --- .github/workflows/build.yml | 36 ++++++++++++++++++++++++++++++++++++ Dockerfile | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100644 Dockerfile diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..3c8d310 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,36 @@ +name: Build and Publish Image + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Log in to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Docker metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: wq/base + + - name: Build and Publish Image + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a1daef4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,34 @@ +FROM python:3.11-bookworm + +# Install base dependencies +RUN apt-get update && apt-get install -y libgdal32 libsqlite3-mod-spatialite +RUN python -m pip install wq gunicorn whitenoise + +# Generate demo project +RUN wq create demo /demo -d localhost -t Demo --with-gis --without-npm +WORKDIR /demo/db +RUN sed -i s/prod/dev/ demo/wsgi.py +RUN sed -i '/SecurityMiddleware/a "whitenoise.middleware.WhiteNoiseMiddleware",' demo/settings/base.py +RUN <> demo/settings/dev.py +STORAGES = { + "staticfiles": { + "BACKEND": "whitenoise.storage.CompressedStaticFilesStorage", + }, +} +EOF +RUN python manage.py deploy 0.0.0 + +# Initialize database with test user +RUN python manage.py migrate +RUN python manage.py createsuperuser --noinput --username=testadmin --email=test@example.com +RUN python manage.py shell <