Skip to content

Commit c4322cf

Browse files
committed
init
1 parent 2ba4f38 commit c4322cf

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed

Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM python:3.12-slim-bookworm
2+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
3+
4+
ENV PYTHONUNBUFFERED 1
5+
6+
WORKDIR /app
7+
8+
# Copy the project into the image
9+
ADD . /app
10+
11+
# Delete .sqlite3 files
12+
RUN find /app -name "*.sqlite3" -delete
13+
14+
# Sync the project into a new environment, using the frozen lockfile
15+
RUN uv sync --frozen
16+
17+
ENTRYPOINT [ "/app/entrypoint.sh" ]

docker-compose.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
version: '3.8'
2+
3+
services:
4+
db:
5+
image: postgres:16
6+
environment:
7+
POSTGRES_DB: pk
8+
POSTGRES_USER: pk
9+
POSTGRES_PASSWORD: pktesting
10+
volumes:
11+
- postgres_data:/var/lib/postgresql/data
12+
13+
web:
14+
build: .
15+
command: /app/entroypoint.sh
16+
ports:
17+
- "8000:8000"
18+
depends_on:
19+
- db
20+
environment:
21+
- DATABASE_URL=postgres://pk:mypassword@db:5432/mydatabase
22+
23+
volumes:
24+
postgres_data:

entrypoint.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
3+
4+
cd /app
5+
source .venv/bin/activate
6+
cd /app/pythonkr_backend
7+
export DJANGO_SETTINGS_MODULE="pythonkr_backend.settings.localtesting"
8+
./manage.py migrate --no-input
9+
./manage.py collectstatic --clear --noinput
10+
gunicorn --workers=2 \
11+
-b :8080 \
12+
--access-logfile - \
13+
--error-logfile - \
14+
pythonkr_backend.wsgi

0 commit comments

Comments
 (0)