diff --git a/Dockerfile b/Dockerfile index db03f5d..f122a76 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/Makefile b/Makefile index 9bce708..64abc52 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,9 @@ clean: rm -rf .mypy_cache cmd-docker-build: - docker build -t ${REPO_OWNER_LOWER}/${REPO_NAME_SNAKE}:$${VERSION} . + docker build \ + -t ${REPO_OWNER_LOWER}/${REPO_NAME_SNAKE}:latest \ + -t ${REPO_OWNER_LOWER}/${REPO_NAME_SNAKE}:$${VERSION} . cmd-docker-push: - docker push ${REPO_OWNER_LOWER}/${REPO_NAME_SNAKE}:$$VERSION + docker push -a ${REPO_OWNER_LOWER}/${REPO_NAME_SNAKE}