Skip to content
Snippets Groups Projects
Verified Commit eb50299d authored by Chris Coley's avatar Chris Coley
Browse files

Refactor images for cleaner building and use

parent cf6ec4b6
Branches
No related tags found
No related merge requests found
...@@ -3,6 +3,7 @@ stages: ...@@ -3,6 +3,7 @@ stages:
- release - release
.build: .build:
stage: build stage: build
tags: [docker] tags: [docker]
...@@ -13,10 +14,12 @@ stages: ...@@ -13,10 +14,12 @@ stages:
- >- - >-
/kaniko/executor /kaniko/executor
--cache=false --cache=false
--target "${BUILD_TARGET}" --skip-unused-stages
--target ${BUILD_TARGET}
--context "${CI_PROJECT_DIR}" --context "${CI_PROJECT_DIR}"
--dockerfile "${CI_PROJECT_DIR}/Dockerfile" --dockerfile "${CI_PROJECT_DIR}/Dockerfile"
--destination "${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}-${BUILD_TARGET}" --destination "${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}-${BUILD_TARGET}"
--label org.opencontainers.image.authors="$LABEL_AUTHORS"
--label org.opencontainers.image.created="$(date -u -Iseconds)" --label org.opencontainers.image.created="$(date -u -Iseconds)"
--label org.opencontainers.image.revision="$CI_COMMIT_SHA" --label org.opencontainers.image.revision="$CI_COMMIT_SHA"
--label org.opencontainers.image.source="$CI_PROJECT_URL" --label org.opencontainers.image.source="$CI_PROJECT_URL"
...@@ -32,20 +35,22 @@ build:iperf3: ...@@ -32,20 +35,22 @@ build:iperf3:
BUILD_TARGET: iperf3 BUILD_TARGET: iperf3
.release: .release:
stage: release stage: release
tags: [docker] tags: [docker]
image: image:
name: gcr.io/go-containerregistry/crane:debug name: gcr.io/go-containerregistry/crane:debug
entrypoint: [''] entrypoint: ['']
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
before_script: before_script:
- crane auth login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - crane auth login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
release:iperf2: release:iperf2:
extends: .release extends: .release
needs: ['build:iperf2'] needs: ['build:iperf2']
script: script:
- crane tag ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}-iperf2 2.2.0
- crane tag ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}-iperf2 2.2 - crane tag ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}-iperf2 2.2
- crane tag ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}-iperf2 2 - crane tag ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}-iperf2 2
...@@ -53,9 +58,7 @@ release:iperf3: ...@@ -53,9 +58,7 @@ release:iperf3:
extends: .release extends: .release
needs: ['build:iperf3'] needs: ['build:iperf3']
script: script:
- crane tag ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}-iperf3 3.17.1
- crane tag ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}-iperf3 3.17 - crane tag ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}-iperf3 3.17
- crane tag ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}-iperf3 3 - crane tag ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}-iperf3 3
# vi: set ts=2 sw=2 et ft=yaml: # vi: set ts=2 sw=2 et ft=yaml:
FROM alpine:3.21 AS base
LABEL org.opencontainers.image.authors="Chris Coley <chris@codingallnight.com>"
# iPerf 2 image # iPerf 2 image
FROM base AS iperf2 FROM alpine:3.21 AS iperf2
ENV IPERF_VERSION="2.2.0-r0" RUN apk add --no-cache iperf=~2.2
RUN apk add --no-cache iperf=${IPERF_VERSION} ENTRYPOINT ["iperf"]
ENTRYPOINT ["iperf", "-s"] CMD ["-s"]
EXPOSE 5001/tcp 5001/udp EXPOSE 5001/tcp 5001/udp
# iPerf 3 image # iPerf 3 image
FROM base AS iperf3 FROM alpine:3.21 AS iperf3
ENV IPERF_VERSION="3.17.1-r0" RUN apk add --no-cache iperf3=~3.17
RUN apk add --no-cache iperf3=${IPERF_VERSION} ENTRYPOINT ["iperf3"]
ENTRYPOINT ["iperf3", "-s"] CMD ["-s"]
EXPOSE 5201/tcp 5201/udp EXPOSE 5201/tcp 5201/udp
# vi: set ts=4 sw=4 et ft=dockerfile: # vi: set ts=4 sw=4 et ft=dockerfile:
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment