I would like to request the addition of a Dockerfile to this project. Having a Dockerfile would allow the project to be easily containerized, making it simpler to deploy and ensuring consistency across different environments.
Benefits
Simplified Deployment: With a Dockerfile, the application can be easily deployed on any system that supports Docker, reducing the potential for environment-related issues.
Environment Consistency: Docker ensures that the application runs in the same environment everywhere, making development, testing, and production environments more consistent.
Ease of Use: Developers and users can easily get the application up and running with minimal setup by using Docker.
Proposed Dockerfile
Here is a proposed Dockerfile based on the current structure of the project:
FROM python:3.12.4-slim-bookworm as py-build
ARG POETRY_VERSION=1.8.3
WORKDIR /app
# Use set -eux to ensure detailed output and error handling
RUN set -eux; \
apt-get update; \
apt-get install -y curl
COPY pyproject.toml poetry.lock /app/
COPY otomati_app /app/otomati_app
RUN touch README.md && touch LICENSE
ENV POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VIRTUALENVS_CREATE=1 \
POETRY_CACHE_DIR=/tmp/poetry_cache \
VIRTUAL_ENV=/app/.venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
RUN pip install poetry==${POETRY_VERSION}
RUN poetry check
# Use -vv to show detailed steps of poetry install
RUN poetry install -vv --no-root --no-dev
FROM python:3.12.4-slim-bookworm
ENV PORT=8009
COPY --from=py-build /app /app
WORKDIR /app
EXPOSE $PORT
EXPOSE 8181
HEALTHCHECK CMD curl --fail http://localhost:$PORT/healthz || exit 1
# Set PYTHONPATH to ensure Python can find otomati_app module
ENV PYTHONPATH=/app
# Use sh -c to indirectly execute command containing environment variable
ENTRYPOINT ["sh", "-c", "streamlit run otomati_app/Home.py --server.port=${PORT:-8009} --server.address=0.0.0.0"]
### Additional Information
_No response_
Description
Summary
I would like to request the addition of a Dockerfile to this project. Having a Dockerfile would allow the project to be easily containerized, making it simpler to deploy and ensuring consistency across different environments.
Benefits
Proposed Dockerfile
Here is a proposed Dockerfile based on the current structure of the project: