Skip to content

Commit 859d192

Browse files
committed
feat(ci): build debug image when branch not default
1 parent 6afc7a5 commit 859d192

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

.gitlab-ci.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,21 @@ default:
55
tags:
66
- ord1-tenant
77

8+
workflow:
9+
rules:
10+
- if: $CI_SOURCE_BRANCH != "coreweave"
11+
variables: &variables
12+
DEBUG_IMAGE: "1"
13+
IMAGE_SUFFIX: "-debug"
14+
815
stages:
916
- build
1017
- release
1118

1219
build:
1320
stage: build
1421
variables:
22+
<<: *variables
1523
REF_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
1624
FIXED_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
1725
DOCKERFILE: ${CI_PROJECT_DIR}/Dockerfile
@@ -25,7 +33,9 @@ build:
2533
script: |-
2634
/kaniko/executor \
2735
$KANIKO_ADDTL_ARGS \
28-
--context . \
36+
--context ${CI_PROJECT_DIR} \
37+
--build-arg DEBUG_IMAGE=${DEBUG_IMAGE} \
38+
--build-arg IMAGE_SUFFIX=${IMAGE_SUFFIX} \
2939
--dockerfile $DOCKERFILE \
3040
--destination $REF_IMAGE \
3141
--destination $FIXED_IMAGE

Dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# This is already multi-arch!
44
ARG BASE_IMAGE="docker.io/rpardini/nginx-proxy-connect-stable-alpine:nginx-1.20.1-alpine-3.12.7"
55
# Could be "-debug"
6-
ARG BASE_IMAGE_SUFFIX=""
6+
ARG BASE_IMAGE_SUFFIX="${IMAGE_SUFFIX}"
77
FROM ${BASE_IMAGE}${BASE_IMAGE_SUFFIX}
88

99
# Link image to original repository on GitHub
@@ -13,8 +13,7 @@ LABEL org.opencontainers.image.source https://github.com/rpardini/docker-registr
1313
RUN apk add --no-cache --update bash ca-certificates-bundle coreutils openssl
1414

1515
# If set to 1, enables building mitmproxy, which helps a lot in debugging, but is super heavy to build.
16-
ARG DEBUG_BUILD="0"
17-
ENV DO_DEBUG_BUILD="$DEBUG_BUILD"
16+
ARG DO_DEBUG_BUILD="${DEBUG_IMAGE:-"0"}"
1817

1918
# Build mitmproxy via pip. This is heavy, takes minutes do build and creates a 90mb+ layer. Oh well.
2019
RUN [[ "a$DO_DEBUG_BUILD" == "a1" ]] && { echo "Debug build ENABLED." \

0 commit comments

Comments
 (0)