New builder, better dockerfile
This commit is contained in:
parent
e9f2922d7f
commit
da7d39d84e
26
Dockerfile
26
Dockerfile
|
@ -1,13 +1,23 @@
|
||||||
FROM debian:11
|
FROM python:3.9-slim as builder
|
||||||
|
|
||||||
MAINTAINER Paul Warren <pwarren@pwarren.id.au>
|
|
||||||
|
|
||||||
RUN apt-get update -y && apt-get install -y python3-pip python3-dev
|
|
||||||
|
|
||||||
ADD . /app
|
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
RUN pip3 install -r requirements.txt
|
RUN apt-get update -y && apt-get install -y --no-install-recommends gcc
|
||||||
|
COPY requirements.txt .
|
||||||
|
RUN pip3 wheel --no-cache-dir --no-deps --wheel-dir /app/wheels -r requirements.txt
|
||||||
|
|
||||||
|
|
||||||
|
FROM python:3.9-slim
|
||||||
|
ARG VERSION
|
||||||
|
ENV VERSION $VERSION
|
||||||
|
ARG BUILD_TIMESTAMP
|
||||||
|
ENV BUILD_TIMESTAMP $BUILD_TIMESTAMP
|
||||||
|
|
||||||
|
MAINTAINER Paul Warren <pwarren@pwarren.id.au>
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=builder /app/wheels /wheels
|
||||||
|
COPY --from=builder /app/requirements.txt /
|
||||||
|
RUN pip install --no-cache /wheels/*
|
||||||
|
ADD . /app
|
||||||
ENTRYPOINT ["./gunicorn_start.sh"]
|
ENTRYPOINT ["./gunicorn_start.sh"]
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
VERSION=$(git log -1 --pretty=%h)
|
VERSION=$(git log -1 --pretty=%h)
|
||||||
REPO="dockerhub.kube:5000/desteg:
|
REPO="dockerhub.kube:5000/desteg:"
|
||||||
TAG="$REPO$VERSION"
|
TAG="$REPO$VERSION"
|
||||||
LATEST="${REPO}latest"
|
LATEST="${REPO}latest"
|
||||||
TS=$( date '+%F_%H:%M:%S; )\\
|
TS=$( date '+%F_%H:%M:%S' )
|
||||||
docker build -t "$TAG" -t "$LATEST" --build-arg VERSION="$VERSION" --build-arg BUILD_TIMESTAMP="$BUILD_TIMESTAMP" .
|
docker build -t "$TAG" -t "$LATEST" --build-arg VERSION="$VERSION" --build-arg BUILD_TIMESTAMP="$BUILD_TIMESTAMP" .
|
||||||
docker push "$TAG"
|
docker push "$TAG"
|
||||||
docker push "$LATEST"
|
docker push "$LATEST"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue