blob: dac70664a3cfd6877d3936a10f56a3a37a3f6d6c [file] [log] [blame]
###########
# BUILDER #
###########
# pull official base image
FROM python:3.8.3-alpine as builder
# set work directory
WORKDIR /tmp
# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# install psycopg2 and uWSGI dependencies
RUN apk update \
&& apk add postgresql-dev gcc python3-dev musl-dev linux-headers
# lint
RUN pip install --upgrade pip
RUN pip install flake8
COPY . .
RUN flake8 --ignore=E501,F401 .
# install dependencies
RUN pip wheel --no-cache-dir --no-deps --wheel-dir /tmp/wheels -r requirements.txt
#########
# FINAL #
#########
FROM python:3.8.3-alpine
ENV PYTHONUNBUFFERED 1
COPY . /testrail_bot/
WORKDIR /testrail_bot
RUN apk update && apk add libpq
COPY --from=builder /tmp/wheels /wheels
COPY --from=builder /tmp/requirements.txt .
RUN pip install --no-cache /wheels/*