Better config

This commit is contained in:
2023-08-21 18:08:27 +02:00
parent 3ee3c8f08c
commit a8943b4a8f
5 changed files with 16 additions and 14 deletions

2
.dockerignore Normal file
View File

@@ -0,0 +1,2 @@
*.pyc
__pycache__/

2
.gitignore vendored
View File

@@ -1,3 +1,5 @@
compose.override.yaml
### Generated by gibo (https://github.com/simonwhitaker/gibo)
### https://raw.github.com/github/gitignore/4488915eec0b3a45b5c63ead28f286819c0917de/Global/macOS.gitignore

View File

@@ -2,17 +2,21 @@ FROM docker.io/python:3.11-slim AS base
WORKDIR /app
RUN apt-get update && apt-get install -y build-essential
ADD requirements.txt ./
RUN pip3 install -r requirements.txt
FROM base as dev
CMD [ "poerty", "run", "uvicorn", "projectorpi_web.app:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
RUN pip3 install poetry
CMD [ "uvicorn", "projectorpi_web.app:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
FROM base as prod
ADD requirements.txt ./
RUN apt-get update && apt-get install -y build-essential \
&& pip install --upgrade pip \
&& pip3 install -r requirements.txt \
&& apt-get remove -y build-essential
ADD projectorpi_web/* ./
CMD gunicorn -w 4 -k uvicorn.workers.UvicornWorker --bind 0.0.0.0:8000 app:app
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "80" ]

View File

@@ -1,6 +0,0 @@
services:
app:
build:
target: dev
volumes:
- .:/app

View File

@@ -5,7 +5,7 @@ services:
context: .
target: prod
ports:
- "80:8000"
- "80:80"
privileged: True
volumes:
- "/dev/serial/by-id:/dev/serial/by-id"