2024-01-13 17:41:40 +01:00
|
|
|
FROM python:3.12 AS builder
|
2022-05-05 19:16:47 +02:00
|
|
|
COPY requirements.txt .
|
|
|
|
|
|
|
|
# install dependencies to the local user directory (eg. /root/.local)
|
2024-01-13 17:41:40 +01:00
|
|
|
RUN pip3 install --user -r requirements.txt
|
2022-05-05 19:16:47 +02:00
|
|
|
|
|
|
|
# second stage
|
2024-01-13 17:41:40 +01:00
|
|
|
FROM python:3.12-slim
|
2024-01-13 18:04:41 +01:00
|
|
|
WORKDIR /source
|
2022-05-05 19:16:47 +02:00
|
|
|
|
|
|
|
# copy only the dependencies that are needed for our application and the source files
|
|
|
|
COPY --from=builder /root/.local /root/.local
|
2024-01-13 17:41:40 +01:00
|
|
|
COPY ./source .
|
2022-05-05 19:16:47 +02:00
|
|
|
|
|
|
|
# update PATH
|
|
|
|
ENV PATH=/root/.local:$PATH
|
|
|
|
|
|
|
|
# make sure you include the -u flag to have our stdout logged
|
|
|
|
# CMD [ "python", "-u", "./main.py" ]
|
|
|
|
EXPOSE 8080
|
|
|
|
# CMD [ "bash", "./run.sh" ]
|
2024-01-13 18:04:41 +01:00
|
|
|
CMD [ "python3", "app.py" ]
|