Switch to only using distroless base image

This commit is contained in:
Magnus Walbeck 2022-04-13 11:42:41 +02:00
commit bcf9956bdc
Signed by: mwalbeck
GPG key ID: CCB78CFF3F950769
4 changed files with 12 additions and 100 deletions

View file

@ -44,31 +44,6 @@ trigger:
depends_on:
- lint
---
kind: pipeline
type: docker
name: test_distroless
steps:
- name: docker
image: plugins/docker
pull: if-not-exists
settings:
dockerfile: Dockerfile.distroless
username:
from_secret: dockerhub_username
password:
from_secret: dockerhub_password_ro
repo: mwalbeck/determine-docker-tags
dry_run: true
trigger:
event:
- pull_request
depends_on:
- lint
---
kind: pipeline
type: docker
@ -96,59 +71,7 @@ steps:
password:
from_secret: dockerhub_password
repo: mwalbeck/determine-docker-tags
- name: notify
image: plugins/matrix
pull: if-not-exists
settings:
homeserver: https://matrix.mwalbeck.org
roomid:
from_secret: matrix_roomid
username:
from_secret: matrix_username
password:
from_secret: matrix_password
when:
status:
- success
- failure
trigger:
branch:
- master
event:
- push
depends_on:
- lint
---
kind: pipeline
type: docker
name: build and publish distroless
steps:
- name: determine tags
image: mwalbeck/determine-docker-tags
pull: if-not-exists
environment:
VERSION_TYPE: "docker_env"
APP_NAME: "DETERMINE_DOCKER_TAGS"
DOCKERFILE_PATH: "Dockerfile.distroless"
APP_ENV: "distroless"
CUSTOM_TAGS: "latest-distroless"
INCLUDE_MAJOR: "no"
- name: build and publish
image: plugins/docker
pull: if-not-exists
settings:
dockerfile: Dockerfile.distroless
username:
from_secret: dockerhub_username
password:
from_secret: dockerhub_password
repo: mwalbeck/determine-docker-tags
- name: notify
image: plugins/matrix
pull: if-not-exists
@ -175,6 +98,6 @@ depends_on:
---
kind: signature
hmac: 5468a46865cb534e9cd686bb8393f5c07d1e8ee56d543b3b4c6e24eef862c717
hmac: 6c21d67e660b19efa956ee044bba61144aecdafbcff9870fc1773482963bab98
...

View file

@ -1,10 +1,15 @@
FROM python:3.8.13-slim-bullseye@sha256:84713dbb75ab4fb81a4a2233e41c4357cfcb6c2a0cb3b5f295deb5cf5ad50850
FROM curlimages/curl:7.82.0@sha256:c1c1cda72ab8c306390fc05518bf4d42148564978326d078f65d546858d139cb as download
# renovate: datasource=pypi depName=determine-docker-tags versioning=semver
ENV DETERMINE_DOCKER_TAGS_VERSION 0.1.10
# renovate: datasource=git-tags depName=https://git.walbeck.it/walbeck-it/determine-docker-tags versioning=semver
ENV DETERMINE_DOCKER_TAGS_VERSION v0.1.10
RUN set -ex; \
\
pip install --no-cache-dir determine-docker-tags==$DETERMINE_DOCKER_TAGS_VERSION;
curl -o /home/curl_user/determine-docker-tags.py \
https://git.walbeck.it/walbeck-it/determine-docker-tags/raw/tag/${DETERMINE_DOCKER_TAGS_VERSION}/determine_docker_tags/__init__.py;
CMD [ "determine-docker-tags" ]
FROM gcr.io/distroless/python3-debian11@sha256:0d8ee86710b55aa06b808a87c025289e9cf15932aa764abd02da84be0e9d819b
COPY --from=download /home/curl_user/determine-docker-tags.py /
CMD [ "/determine-docker-tags.py" ]

View file

@ -1,15 +0,0 @@
FROM curlimages/curl:7.82.0@sha256:c1c1cda72ab8c306390fc05518bf4d42148564978326d078f65d546858d139cb as download
# renovate: datasource=git-tags depName=https://git.walbeck.it/walbeck-it/determine-docker-tags versioning=semver
ENV DETERMINE_DOCKER_TAGS_VERSION v0.1.10
RUN set -ex; \
\
curl -o /home/curl_user/determine-docker-tags.py \
https://git.walbeck.it/walbeck-it/determine-docker-tags/raw/tag/${DETERMINE_DOCKER_TAGS_VERSION}/determine_docker_tags/__init__.py;
FROM gcr.io/distroless/python3-debian11@sha256:0d8ee86710b55aa06b808a87c025289e9cf15932aa764abd02da84be0e9d819b
COPY --from=download /home/curl_user/determine-docker-tags.py /
CMD [ "/determine-docker-tags.py" ]

View file

@ -7,10 +7,9 @@ This is a docker image for determine-docker-tags. determine-docker-tags is a sma
The program is configured entirely with environment variables for easy configuration. For a overview over the configuration options and what they do I'll referrer you to the [determine-docker-tags repo](https://git.walbeck.it/walbeck-it/determine-docker-tags). If you would like a practical example of how to use it, you can check out the `.drone.yml` file in this repo, where you will find an example of how to use the image in the first step of the `build and release` pipelines.
There are two variants of this image. One using the offical debian based python image and one using the distroless python variant. The relevant tags are as follows (x is a placeholder for the current patch version):
The relevant tags are as follows (x is a placeholder for the current patch version):
* 0.1, 0.1.x, latest
* 0.1-distroless, 0.1.x-distroless, latest-distroless
## License