Optimized docker image size, added ":latest" tag to Makefile docker build commands

This commit is contained in:
DarkCat09 2023-03-03 17:16:40 +04:00
parent 8e6b0a39b2
commit 2135126235
2 changed files with 15 additions and 5 deletions

View file

@ -1,7 +1,15 @@
FROM python:3-alpine
RUN apk update && apk upgrade && apk add py-pip make
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 install -r requirements.txt
RUN pip wheel --no-cache-dir -w /app/wheels -r requirements.txt
FROM alpine:latest as run
RUN apk add --no-cache python3 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 apk del py3-pip && rm -rf /app/wheels
CMD make prod
EXPOSE 8000