add docker setup
This commit is contained in:
1 parent
e0cb73e57a
commit
95844407bb
3 files changed
+58
-1
No files matched your search
@@ -12,7 +12,11 @@ The endpoint serves the 10 upcoming screenings for the day. The frontend automat
|
|||||||
|
|
||||||
## Run
|
## Run
|
||||||
|
|
||||||
`poetry run uvicorn fdhview.main:app --reload`
|
For development run the application locally:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
poetry run uvicorn fdhview.main:app --reload
|
||||||
|
```
|
||||||
|
|
||||||
## Endpoints
|
## Endpoints
|
||||||
|
|
||||||
@@ -21,3 +25,11 @@ The endpoint serves the 10 upcoming screenings for the day. The frontend automat
|
|||||||
* GET `/info` - serves desk info endpoint
|
* GET `/info` - serves desk info endpoint
|
||||||
* GET `/api/screenings` - serves JSON with upcoming 10 films for today
|
* GET `/api/screenings` - serves JSON with upcoming 10 films for today
|
||||||
* GET `/api/screenings/prices` - serves JSON with pricing data
|
* GET `/api/screenings/prices` - serves JSON with pricing data
|
||||||
|
|
||||||
|
## Docker
|
||||||
|
|
||||||
|
Run the container with docker-compose:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker compose -f docker/docker-compose.yml up
|
||||||
|
```
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
FROM python:3.14-slim AS builder
|
||||||
|
|
||||||
|
ENV POETRY_NO_INTERACTION=1 \
|
||||||
|
POETRY_VIRTUALENVS_IN_PROJECT=true
|
||||||
|
|
||||||
|
RUN pip install --upgrade pip
|
||||||
|
RUN pip install poetry
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY poetry.lock pyproject.toml ./
|
||||||
|
|
||||||
|
RUN poetry install --only main --no-root
|
||||||
|
|
||||||
|
|
||||||
|
FROM python:3.14-slim AS runtime
|
||||||
|
|
||||||
|
ENV PYTHONUNBUFFERED=1 \
|
||||||
|
PYTHONDONTWRITEBYTECODE=1
|
||||||
|
|
||||||
|
RUN adduser --disabled-password --gecos "" appuser
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY --from=builder /app/.venv /app/.venv
|
||||||
|
COPY --from=builder /app/pyproject.toml /app/poetry.lock ./
|
||||||
|
COPY . /app
|
||||||
|
|
||||||
|
RUN mkdir -p /data && chown appuser:appuser /data
|
||||||
|
|
||||||
|
ENV PATH="/app/.venv/bin:$PATH"
|
||||||
|
|
||||||
|
USER appuser
|
||||||
|
|
||||||
|
EXPOSE 8000
|
||||||
|
CMD ["uvicorn", "fdhview.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
services:
|
||||||
|
app:
|
||||||
|
build:
|
||||||
|
context: ..
|
||||||
|
dockerfile: docker/Dockerfile
|
||||||
|
ports:
|
||||||
|
- "8000:8000"
|
||||||
|
environment:
|
||||||
|
SQL_FILE_NAME: ${SQL_FILE_NAME:-/data/app.db}
|
||||||
Reference in new issue
Block a user