Skip to content

Commit

Permalink
podman-compose: rework
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Spooren <mail@aparcar.org>
  • Loading branch information
aparcar committed May 8, 2023
1 parent 066d8a7 commit 01e241b
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 104 deletions.
30 changes: 7 additions & 23 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,11 @@ jobs:
--username ${{ secrets.PYPI_USERNAME }} \
--password ${{ secrets.PYPI_PASSWORD }}
- name: Docker meta server
id: meta_server
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: aparcar/asu-server
tags: |
type=semver,pattern={{version}}
- name: Docker meta worker
id: meta_worker
uses: docker/metadata-action@v3
with:
images: aparcar/asu-worker
images: aparcar/asu
tags: |
type=semver,pattern={{version}}
Expand All @@ -56,18 +48,10 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push ASU server to Docker Hub
uses: docker/build-push-action@v2
with:
file: Dockerfile.server
push: true
tags: ${{ steps.meta_server.outputs.tags }}
labels: ${{ steps.meta_server.outputs.labels }}

- name: Build and push ASU worker to Docker Hub
- name: Build and push ASU to Docker Hub
uses: docker/build-push-action@v2
with:
file: Dockerfile.worker
file: Containerfile
push: true
tags: ${{ steps.meta_worker.outputs.tags }}
labels: ${{ steps.meta_worker.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ instance/
json/
poetry.lock
public/
redis/
site/
store/
var/
16 changes: 16 additions & 0 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM python:3.10-slim

WORKDIR /app/

RUN pip install poetry

COPY poetry.lock pyproject.toml ./

RUN poetry config virtualenvs.create false \
&& poetry install --only main --no-interaction --no-ansi

COPY ./asu/ ./asu/

COPY ./misc/config.py /etc/asu/config.py

CMD gunicorn 'asu.asu:create_app()' --bind 0.0.0.0:8000
19 changes: 0 additions & 19 deletions Dockerfile.server

This file was deleted.

19 changes: 0 additions & 19 deletions Dockerfile.worker

This file was deleted.

43 changes: 0 additions & 43 deletions docker-compose.yml

This file was deleted.

61 changes: 61 additions & 0 deletions podman-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
version: "2"
volumes:
podman-sock:
redis:
services:
server:
image: "aparcar/asu:latest"
environment:
- REDIS_HOST=redis
volumes:
- "./asu-service/public/:/app/public/"
ports:
- "127.0.0.1:8000:8000"
depends_on:
- redis

janitor:
image: "aparcar/asu:latest"
environment:
- FLASK_APP=asu.asu
- FLASK_DEBUG=1
- REDIS_HOST=redis
command: flask janitor update
volumes:
- "./asu-service/public/:/app/public/"
depends_on:
- redis

worker:
image: "aparcar/asu:latest"
command: rqworker --url "redis://redis"
environment:
- CONTAINER_HOST=unix:///tmp/socket/podman.sock
volumes:
- ./asu-service/public/:/app/public/
- podman-sock:/tmp/socket/
depends_on:
- redis
- podman

podman:
image: quay.io/podman/stable
user: podman
volumes:
- podman-sock:/tmp/socket/
command: sh -c "mkdir -p /tmp/socket && podman system service --time=0 unix:///tmp/socket/podman.sock"

redis:
image: "redis:alpine"
volumes:
- redis:/data/

webserver:
image: caddy
volumes:
- "./misc/Caddyfile:/etc/caddy/Caddyfile"
- "./asu-service:/site/"
ports:
- "8000:8081"
depends_on:
- server

0 comments on commit 01e241b

Please sign in to comment.