-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use poetry and update compose.yaml production
- Loading branch information
Maël Marchand
committed
Dec 27, 2023
1 parent
9ea4b6d
commit 2ce36b0
Showing
10 changed files
with
1,176 additions
and
252 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,27 @@ | ||
FROM python:3.9.4-buster | ||
FROM python:3.11.5-alpine3.18 | ||
|
||
ENV PYTHONUNBUFFERED 1 | ||
ENV PYTHONDONTWRITEBYTECODE 1 | ||
|
||
RUN apk update && apk add --no-cache tzdata | ||
ENV TZ=Europe/Paris | ||
|
||
WORKDIR /app | ||
|
||
# Install dependencies | ||
COPY requirements.txt . | ||
RUN pip -q install -r requirements.txt | ||
RUN apt-get -qq update && apt-get -yqq install default-jre | ||
COPY pyproject.toml poetry.lock ./ | ||
RUN pip install poetry==1.6.1 \ | ||
&& poetry config virtualenvs.create false \ | ||
&& apk add --no-cache libpq-dev \ | ||
&& apk add --no-cache --virtual .build-deps \ | ||
build-base \ | ||
&& poetry install --no-interaction --no-ansi \ | ||
&& apk add --no-cache \ | ||
openjdk17 \ | ||
&& apk del .build-deps | ||
|
||
COPY . ./ | ||
|
||
RUN python manage.py collectstatic --noinput | ||
|
||
EXPOSE 80 | ||
CMD ["daphne", "project.asgi:application", "-b", "0.0.0.0", "-p", "80"] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,65 @@ | ||
version: "3.9" | ||
|
||
services: | ||
postgres: | ||
container_name: mc_manager_db | ||
image: postgres | ||
volumes: | ||
- ./vardb:/var/lib/postgresql/data | ||
- database:/var/lib/postgresql/data | ||
networks: | ||
- default | ||
environment: | ||
- POSTGRES_DB=mcmanager | ||
- POSTGRES_USER=postgres | ||
- POSTGRES_PASSWORD=postgres | ||
daphne: | ||
build: . | ||
command: > | ||
bash -c "python manage.py migrate --noinput && | ||
python manage.py collectstatic --noinput && | ||
daphne project.asgi:application -b 0.0.0.0 -p 8000" | ||
restart: always | ||
|
||
django: &django | ||
container_name: mc_manager | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
deploy: | ||
restart_policy: | ||
condition: any | ||
resources: | ||
limits: | ||
cpus: "2" | ||
memory: 6G | ||
reservations: | ||
cpus: ".1" | ||
memory: 256M | ||
depends_on: | ||
- postgres | ||
networks: | ||
- default | ||
- traefik | ||
volumes: | ||
- .:/app:delegated | ||
- data:/data | ||
ports: | ||
- "8000:8000" | ||
- "25565-25600:25565-25600" | ||
depends_on: | ||
- postgres | ||
labels: | ||
traefik.enable: true | ||
traefik.docker.network: traefik | ||
traefik.http.routers.mc_manager.rule: Host(`minecraft.marchand.cloud`) | ||
traefik.http.routers.mc_manager.entrypoints: https | ||
traefik.http.routers.mc_manager.tls: true | ||
traefik.http.routers.mc_manager.tls.certresolver: letsencrypt | ||
|
||
django_migration: | ||
<<: *django | ||
container_name: mc_manager_migration | ||
deploy: {} | ||
command: python manage.py migrate | ||
volumes: [] | ||
ports: [] | ||
labels: {} | ||
|
||
networks: | ||
default: | ||
traefik: | ||
external: true | ||
name: traefik | ||
|
||
volumes: | ||
var: | ||
driver: local | ||
vardb: | ||
driver: local | ||
|
||
data: | ||
database: |
Oops, something went wrong.