The docker file was updated to align with the software requirements of the app. An additional script `install_odbc.sh` is added to install the required microsoft ODBC driver.
49 lines
1.2 KiB
Docker
49 lines
1.2 KiB
Docker
ARG PYTHON_VERSION_TAG=3.12
|
|
ARG PYTHON_VARIANT_TAG=slim
|
|
|
|
# Use official Python image as base
|
|
# ${PYTHON_VARIANT_TAG:+-${PYTHON_VARIANT_TAG}} is a conditional expansion
|
|
# that adds a dash before the variant tag if it is not empty
|
|
FROM python:${PYTHON_VERSION_TAG}${PYTHON_VARIANT_TAG:+-${PYTHON_VARIANT_TAG}}
|
|
|
|
# Set up poetry environment
|
|
ARG POETRY_VERSION=1.8.3
|
|
|
|
ENV POETRY_HOME=/opt/poetry
|
|
ENV POETRY_VENV=/opt/poetry-venv
|
|
ENV POETRY_CACHE_DIR=/opt/.cache
|
|
|
|
# Install poetry separated from system interpreter
|
|
RUN python3 -m venv $POETRY_VENV \
|
|
&& $POETRY_VENV/bin/pip install -U pip setuptools \
|
|
&& $POETRY_VENV/bin/pip install poetry==${POETRY_VERSION}
|
|
|
|
# Add `poetry` to PATH
|
|
ENV PATH="${POETRY_VENV}/bin:${PATH}"
|
|
|
|
RUN poetry config virtualenvs.in-project true
|
|
|
|
# Export in first position so that "python" calls are from .venv
|
|
ENV PATH="/app/.venv/bin:${PATH}"
|
|
ENV PYTHONPATH="/app/:${PYTHONPATH}"
|
|
|
|
COPY pyproject.toml .
|
|
COPY poetry.lock .
|
|
COPY app/ app/
|
|
|
|
RUN poetry install --no-interaction --no-dev
|
|
|
|
COPY ./.docker/entrypoint.sh /app/entrypoint.sh
|
|
COPY ./.docker/install_odbc.sh /app/install_odbc.sh
|
|
|
|
RUN chmod +x /app/entrypoint.sh
|
|
RUN chmod +x /app/install_odbc.sh
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
EXPOSE 80
|
|
EXPOSE 8000
|
|
|
|
ENTRYPOINT ["./entrypoint.sh"]
|