-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathDockerfile_stop_word
47 lines (32 loc) · 1.19 KB
/
Dockerfile_stop_word
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
45
46
47
#from https://medium.com/@albertazzir/blazing-fast-python-docker-builds-with-poetry-a78a66f5aed0
FROM python:3.12.7 as builder
ENV VIRTUAL_ENV=/app/.venv
ENV POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VIRTUALENVS_CREATE=1 \
POETRY_CACHE_DIR=/tmp/poetry_cache
WORKDIR /app
COPY pyproject.toml poetry.lock ./
RUN pip install poetry==2.0.1
RUN poetry install --no-root
# The runtime image, used to just run the code provided its virtual environment
FROM python:3.12.7-slim as runtime
WORKDIR /app
ENV VIRTUAL_ENV=/app/.venv
ENV PATH="/app/.venv/bin:$PATH"
ENV PATH="$PYENV_ROOT/bin:$PATH"
ENV PYTHONPATH=/app
COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}
# App code is include with docker-compose as well
COPY quotaclimat ./quotaclimat
COPY postgres ./postgres
COPY pyproject.toml pyproject.toml
COPY alembic/ ./alembic
COPY alembic.ini ./alembic.ini
COPY transform_program.py ./transform_program.py
# healthcheck
EXPOSE 5050
# Use a separate script to handle migrations and start the application
COPY docker-entrypoint_stop_word.sh ./docker-entrypoint_stop_word.sh
RUN chmod +x ./docker-entrypoint_stop_word.sh
ENTRYPOINT ["./docker-entrypoint_stop_word.sh"]