fix dockerfile

This commit is contained in:
deflax 2024-02-23 19:05:20 +02:00
parent ee74acad1d
commit 1ca27ea862

View file

@ -1,38 +1,3 @@
###########
# BUILDER #
###########
# pull official base image
FROM python:3 as builder
# set work directory
WORKDIR /usr/src/app
# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# install system dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends gcc
# lint
RUN pip install --upgrade pip
RUN pip install flake8
COPY . /usr/src/app/
#RUN flake8 --ignore=E501,F401 .
# install python dependencies
COPY ./requirements.txt .
RUN --mount=type=cache,target=/root/.cache \
pip install --wheel-dir /usr/src/app/wheels -r requirements.txt
#########
# FINAL #
#########
# pull official base image
FROM python:3 FROM python:3
# create directory for the app user # create directory for the app user
@ -47,11 +12,10 @@ RUN mkdir $APP_HOME
WORKDIR $APP_HOME WORKDIR $APP_HOME
# install dependencies # install dependencies
RUN apt-get update && apt-get install -y --no-install-recommends netcat-openbsd RUN apt-get update && apt-get install -y --no-install-recommends netcat-openbsd gcc
COPY --from=builder /usr/src/app/wheels /wheels
COPY --from=builder /usr/src/app/requirements.txt . COPY ./requirements.txt .
RUN pip install --upgrade pip RUN pip install -r requirements.txt
RUN pip install --no-cache /wheels/*
# copy entrypoint.sh # copy entrypoint.sh
COPY ./entrypoint.sh $APP_HOME COPY ./entrypoint.sh $APP_HOME
@ -66,4 +30,5 @@ RUN chown -R app:app $APP_HOME
USER app USER app
# run entrypoint.sh # run entrypoint.sh
ENTRYPOINT ["/home/app/web/entrypoint.sh"] ENTRYPOINT ["./entrypoint.sh"]