-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit bfe056d
Showing
2 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <<EOF >> 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 protected] | ||
RUN python manage.py shell <<EOF | ||
from django.contrib.auth.models import User | ||
user = User.objects.get(username="testadmin") | ||
user.set_password("testadmin") | ||
user.save() | ||
EOF | ||
|
||
# Run server | ||
ENV PYTHONUNBUFFERED 1 | ||
EXPOSE 8080 | ||
CMD ["gunicorn", "demo.wsgi", "-b", ":8080", "--workers", "2", "--access-logfile", "-"] |