| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- # syntax=docker/dockerfile:1
- ##################
- # BUILDER #
- ##################
- FROM python:3.11-slim AS builder
- # set work directory
- WORKDIR /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==6.0.0
- COPY . /app/
- RUN flake8 --ignore=E501,F401,E126,E722 .
- COPY ./src/requirements.txt .
- RUN pip wheel --no-cache-dir --no-deps --wheel-dir /app/wheels -r requirements.txt
- ##################
- # FINAL #
- ##################
- FROM python:3.11-slim
- # create the appropriate directories
- ENV APP_HOME=/app
- RUN mkdir -p $APP_HOME
- WORKDIR $APP_HOME
- # install system dependencies
- RUN apt-get update && apt-get install nginx netcat-openbsd curl vim jq rsync libpango-1.0-0 libpangocairo-1.0-0 libcairo2 -y
- COPY --from=builder /app/wheels /wheels
- COPY --from=builder /app/requirements.txt .
- RUN pip install --upgrade pip
- RUN pip install --no-cache /wheels/*
- # copia fichero de configuración de nginx
- COPY ./nginx/nginx.conf /etc/nginx/
- # enlace los logs de nginx a stdout
- RUN ln -sf /dev/stdout /var/log/nginx/access.log && ln -sf /dev/stderr /var/log/nginx/error.log
- # copy entrypoint.sh
- COPY ./entrypoint.sh .
- # copy project
- COPY . $APP_HOME
- # change to the app user
- WORKDIR $APP_HOME/src
- # run entrypoint.sh
- ENTRYPOINT ["/app/entrypoint.sh"]
|