-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
44 lines (33 loc) · 944 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
42
43
44
FROM python:3.12-slim-bullseye AS builder
WORKDIR /app
## Install poetry
RUN apt-get update && \
apt-get install -y curl && \
curl -sSL https://install.python-poetry.org | python3 -
## generate requirements.txt
COPY pyproject.toml poetry.lock ./
RUN /root/.local/bin/poetry self add poetry-plugin-export && \
/root/.local/bin/poetry export --format=requirements.txt --output=requirements.txt
# Build the final image
FROM python:3.12-slim-bullseye
# default port for Flask
EXPOSE 8000
# default port for Flower
EXPOSE 5555
WORKDIR /app
## requirements
COPY --from=builder /app/requirements.txt .
RUN pip install -r requirements.txt && rm requirements.txt
## copy entrypoint
COPY . .
RUN chmod +x entrypoint.sh && \
rm -rfv poetry.lock pyproject.toml
## copy app
WORKDIR /app/fob_api
COPY fob_api .
## create user
RUN useradd -m fob && chown -Rv fob:fob /app
USER fob
## run
WORKDIR /app
ENTRYPOINT ["./entrypoint.sh"]