Dockerize application
This commit is contained in:
parent
f87dd17bdc
commit
e3ab204f62
|
@ -0,0 +1,8 @@
|
|||
**/.git*
|
||||
**/__pycache__
|
||||
*.md
|
||||
.dockerignore
|
||||
.env*
|
||||
Dockerfile
|
||||
db.sqlite3
|
||||
docker-compose.yml
|
|
@ -0,0 +1,28 @@
|
|||
FROM python:3.11-alpine3.18 AS requirements
|
||||
|
||||
WORKDIR /workdir
|
||||
|
||||
RUN pip --no-cache-dir install poetry
|
||||
|
||||
COPY poetry.lock pyproject.toml /workdir/
|
||||
RUN poetry export -f requirements.txt -o /requirements.txt
|
||||
|
||||
|
||||
FROM python:3.11-alpine3.18
|
||||
|
||||
ENV PORT=8000
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN pip --no-cache-dir install gunicorn
|
||||
|
||||
COPY --from=requirements /requirements.txt /app/
|
||||
RUN pip --no-cache-dir install -r requirements.txt
|
||||
|
||||
COPY LICENSE manage.py /app/
|
||||
COPY ljg /app/ljg/
|
||||
COPY docker/entrypoint.sh /
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
|
||||
services:
|
||||
app:
|
||||
build: .
|
||||
restart: unless-stopped
|
||||
env_file: .env
|
||||
ports:
|
||||
- 127.0.0.1:8000:8000
|
||||
volumes:
|
||||
- ./db.sqlite3:/app/db.sqlite3
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -ex
|
||||
|
||||
python manage.py migrate
|
||||
|
||||
if [ -z "$1" ] || [ "${1%-}" != "$1" ]
|
||||
then
|
||||
exec gunicorn ljg.wsgi "$@"
|
||||
fi
|
||||
|
||||
exec "$@"
|
Loading…
Reference in New Issue