| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- # 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/*
- # 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"]
|