| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- # syntax=docker/dockerfile:1
- ##################
- # BUILDER #
- ##################
- FROM python:3.11.4-slim-buster 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.4-slim-buster
- # 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 -y sqlite3 netcat vim procps curl jq
- 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"]
|