nopaque/Dockerfile

61 lines
1.4 KiB
Docker
Raw Permalink Normal View History

2023-10-04 11:48:32 +00:00
FROM python:3.10.13-slim-bookworm
2022-11-11 13:59:14 +00:00
LABEL authors="Patrick Jentsch <p.jentsch@uni-bielefeld.de>"
# Set environment variables
2022-11-11 13:59:14 +00:00
ENV LANG="C.UTF-8"
ENV PYTHONDONTWRITEBYTECODE="1"
ENV PYTHONUNBUFFERED="1"
# Install system dependencies
2022-11-11 13:59:14 +00:00
RUN apt-get update \
&& apt-get install --no-install-recommends --yes \
build-essential \
2023-09-25 08:11:11 +00:00
gosu \
2022-11-11 13:59:14 +00:00
libpq-dev \
&& rm --recursive /var/lib/apt/lists/*
# Create a non-root user
2023-09-25 08:11:11 +00:00
RUN useradd --create-home --no-log-init nopaque \
&& groupadd docker \
&& usermod --append --groups docker nopaque
2022-11-11 13:59:14 +00:00
2023-09-25 08:11:11 +00:00
USER nopaque
WORKDIR /home/nopaque
# Create a Python virtual environment
2023-09-25 08:11:11 +00:00
ENV NOPAQUE_PYTHON3_VENV_PATH="/home/nopaque/.venv"
RUN python3 -m venv "${NOPAQUE_PYTHON3_VENV_PATH}"
ENV PATH="${NOPAQUE_PYTHON3_VENV_PATH}/bin:${PATH}"
2022-11-11 13:59:14 +00:00
# Install Python dependencies
COPY --chown=nopaque:nopaque requirements.txt requirements.txt
RUN python3 -m pip install --requirement requirements.txt \
&& rm requirements.txt
# Install the application
COPY docker-nopaque-entrypoint.sh /usr/local/bin/
2022-11-11 13:59:14 +00:00
COPY --chown=nopaque:nopaque app app
COPY --chown=nopaque:nopaque migrations migrations
COPY --chown=nopaque:nopaque tests tests
2023-09-25 08:11:11 +00:00
COPY --chown=nopaque:nopaque .flaskenv boot.sh config.py nopaque.py requirements.txt ./
RUN mkdir logs
2023-09-25 08:11:11 +00:00
EXPOSE 5000
USER root
2022-11-11 13:59:14 +00:00
ENTRYPOINT ["docker-nopaque-entrypoint.sh"]