Files
cisticola/Dockerfile
2023-05-04 14:04:55 +02:00

42 lines
937 B
Docker

FROM python:3.9-slim as base
# Setup env
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONFAULTHANDLER 1
FROM base AS python-deps
# Install pipenv and compilation dependencies
RUN pip install pipenv
RUN apt-get update && apt-get install -y --no-install-recommends gcc g++ git libpq-dev musl-dev
# Install python dependencies in /.venv
COPY Pipfile .
COPY Pipfile.lock .
RUN PIPENV_VENV_IN_PROJECT=1 pipenv install --deploy
FROM base AS runtime
RUN apt-get update && apt-get install -y --no-install-recommends cron libpq-dev
# Copy virtual env from python-deps stage
COPY --from=python-deps /.venv /.venv
ENV PATH="/.venv/bin:$PATH"
# Create and switch to a new user
# RUN useradd --create-home appuser
WORKDIR /root
# USER appuser
# Install application into container
COPY . .
RUN ./spacy_setup.sh
# Copy crontab and start cron in foreground mode
COPY crontab /etc/crontabs/root
CMD ["cron", "-f"]