-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
41 lines (28 loc) · 918 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
FROM python:3.12-alpine AS base
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \
POETRY_VIRTUALENVS_IN_PROJECT=true \
PATH="/app/.venv/bin:$PATH"
# Rebuild the source code only when needed
FROM base AS builder
RUN apk add build-base libffi-dev postgresql-dev
RUN pip install poetry==1.8.2
WORKDIR /app
COPY pyproject.toml poetry.lock ./
RUN poetry install --no-root
# Production image, copy all the files and run next
FROM base AS runner
RUN apk add libpq --no-cache
WORKDIR /app
RUN addgroup --system --gid 1001 bfbc2emu
RUN adduser --system --uid 1001 bfbc2emu
COPY --chown=bfbc2emu:bfbc2emu bfbc2_masterserver ./bfbc2_masterserver
COPY --from=builder --chown=bfbc2emu:bfbc2emu /app/.venv ./.venv
ADD static /app/static
USER bfbc2emu
EXPOSE 8000
ENV PORT 8000
ENTRYPOINT [ "fastapi" ]
CMD [ "run", "bfbc2_masterserver" ]