tmpl-fastapi/Dockerfile

15 lines
566 B
Docker

FROM alpine:latest as build
RUN apk add --no-cache python3 python3-dev py3-pip mariadb-dev build-base
RUN pip install --no-cache-dir wheel
WORKDIR /app
COPY . .
RUN pip wheel --no-cache-dir -w /app/wheels -r requirements.txt
FROM alpine:latest as run
RUN apk add --no-cache python3 py3-setuptools py3-pip make mariadb-connector-c-dev
COPY --from=build /app /app
WORKDIR /app
RUN pip install --no-cache-dir --find-links /app/wheels -r requirements.txt
RUN pip cache purge && apk del py3-pip && rm -rf /var/cache/apk/* && rm -rf /app/wheels
CMD make prod
EXPOSE 8000