Skip to content

Commit f0defe8

Browse files
committed
add python container
1 parent 37710ef commit f0defe8

File tree

6 files changed

+48
-5
lines changed

6 files changed

+48
-5
lines changed

compose.yaml

+21-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ services:
4545
container_name: openchurch_backend
4646
build:
4747
context: .
48-
dockerfile: Dockerfile
48+
dockerfile: ./docker/php/Dockerfile
4949
volumes:
5050
- .:/var/www/html
5151
- ./usr/local/bin/docker-php-entrypoint:/usr/local/bin/docker-php-entrypoint
@@ -61,6 +61,26 @@ services:
6161
environment:
6262
SERVER_NAME: localhost api.openchurch.local admin.openchurch.local
6363
DATABASE_URL: mysql://root:openchurch@db:3306/openchurch?serverVersion=11.5.2-MariaDB&charset=utf8mb4
64+
65+
python:
66+
container_name: openchurch_python
67+
build:
68+
context: .
69+
dockerfile: ./docker/python/Dockerfile
70+
volumes:
71+
- ./scripts:/app
72+
- ./.env:/app/.env
73+
entrypoint: ["sh", "/usr/local/bin/docker-python-entrypoint"]
74+
command: ["/bin/sh"]
75+
tty: true
76+
stdin_open: true
77+
networks:
78+
- app-network
79+
extra_hosts:
80+
- "api.openchurch.local:host-gateway"
81+
depends_on:
82+
- backend
83+
6484
volumes:
6585
openchurch_db_data: {}
6686

Dockerfile docker/php/Dockerfile

File renamed without changes.

docker/python/Dockerfile

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM alpine:3.20.3
2+
3+
WORKDIR /app
4+
5+
RUN apk update && apk add --update --no-cache \
6+
python3 \
7+
py3-pip \
8+
&& ln -sf python3 /usr/bin/python
9+
10+
COPY ./usr/local/bin/docker-python-entrypoint /usr/local/bin/
11+
COPY .env /app/

scripts/.gitignore

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Created by venv; see https://docs.python.org/3/library/venv.html
2-
bin
3-
include
4-
lib
2+
venv
3+
.env
54
*.sqlite
65
pyvenv.cfg
76
pywikibot.lwp

scripts/synchro.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from requests.adapters import HTTPAdapter
2121
from urllib3.util.retry import Retry
2222

23-
load_dotenv(dotenv_path='../.env')
23+
load_dotenv(dotenv_path='.env')
2424
sentry_sdk.init(dsn=os.getenv('SENTRY_DSN_SYNCHRO'))
2525

2626
endpoint = "https://query.wikidata.org/bigdata/namespace/wdq/sparql"
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
set -e
3+
4+
python3 -m venv ./venv
5+
6+
. ./venv/bin/activate
7+
8+
pip install -r requirements.txt
9+
10+
pip uninstall urllib3 -y \
11+
&& pip install urllib3
12+
13+
exec "$@"

0 commit comments

Comments
 (0)