mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-02-03 00:31:25 -08:00
Merge pull request 'infra/dockerizing' (#61) from saint/pyfedi:infra/dockerizing into main
Reviewed-on: https://codeberg.org/rimu/pyfedi/pulls/61
This commit is contained in:
commit
640b8151c0
5 changed files with 74 additions and 0 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -162,3 +162,7 @@ cython_debug/
|
|||
app/static/*.css.map
|
||||
/app/static/media/
|
||||
celery_worker.py
|
||||
|
||||
# sensitive data
|
||||
.env.docker
|
||||
.gunicorn.conf.py
|
||||
|
|
22
Dockerfile
Normal file
22
Dockerfile
Normal file
|
@ -0,0 +1,22 @@
|
|||
# syntax=docker/dockerfile:1.4
|
||||
FROM --platform=$BUILDPLATFORM python:3-alpine AS builder
|
||||
|
||||
|
||||
RUN apk update
|
||||
RUN apk add pkgconfig
|
||||
RUN apk add --virtual build-deps gcc python3-dev musl-dev
|
||||
|
||||
WORKDIR /app
|
||||
COPY . /app
|
||||
|
||||
RUN pip3 install -r requirements.txt
|
||||
RUN pip3 install gunicorn
|
||||
|
||||
RUN chmod u+x ./entrypoint.sh
|
||||
RUN chmod u+x ./entrypoint_celery.sh
|
||||
|
||||
RUN adduser -D python
|
||||
RUN chown -R python:python /app
|
||||
|
||||
USER python
|
||||
ENTRYPOINT ["./entrypoint.sh"]
|
42
compose.yaml
Normal file
42
compose.yaml
Normal file
|
@ -0,0 +1,42 @@
|
|||
services:
|
||||
db:
|
||||
shm_size: 128mb
|
||||
image: postgres
|
||||
env_file:
|
||||
- ./.env.docker
|
||||
volumes:
|
||||
- pgdata:/var/lib/postgresql/data
|
||||
redis:
|
||||
image: redis
|
||||
env_file:
|
||||
- ./.env.docker
|
||||
celery:
|
||||
build:
|
||||
context: .
|
||||
target: builder
|
||||
env_file:
|
||||
- ./.env.docker
|
||||
entrypoint: ./entrypoint_celery.sh
|
||||
web:
|
||||
build:
|
||||
context: .
|
||||
target: builder
|
||||
depends_on:
|
||||
- db
|
||||
- redis
|
||||
env_file:
|
||||
- ./.env.docker
|
||||
volumes:
|
||||
- ./.env:/app/.env
|
||||
- ./.gunicorn.conf.py:/app/gunicorn.conf.py
|
||||
ports:
|
||||
- '8080:5000'
|
||||
adminer:
|
||||
image: adminer
|
||||
restart: always
|
||||
ports:
|
||||
- 8888:8080
|
||||
volumes:
|
||||
pgdata:
|
||||
|
||||
|
3
entrypoint.sh
Normal file
3
entrypoint.sh
Normal file
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/env sh
|
||||
flask db upgrade
|
||||
gunicorn --config gunicorn.conf.py --preload pyfedi:app
|
3
entrypoint_celery.sh
Normal file
3
entrypoint_celery.sh
Normal file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
celery -A celery_worker.celery worker
|
Loading…
Add table
Reference in a new issue