Skip to content

Commit 3105cb9

Browse files
mumoshuhexcsl
authored andcommitted
Fix docker-run-release
This adds Dockerfile.release and fix the docker-run-release make target to work using the image built from it. Setting docker-run --user did not actually work for me due to some git-and-ssh-related operations failing with `No user exists for uid` errors.
1 parent 752a0b6 commit 3105cb9

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Ignore everything
2+
*

Dockerfile.release

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM golang:1.19.8
2+
3+
# See https://github.com/cli/cli/blob/trunk/docs/install_linux.md#debian-ubuntu-linux-raspberry-pi-os-apt
4+
# for the latest gh install instructions when the below didn't work
5+
6+
RUN type -p curl >/dev/null || (apt update && apt install curl -y)
7+
8+
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
9+
&& chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
10+
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
11+
&& apt update \
12+
&& apt install gh -y
13+
14+
ARG HELM_DIFF_UID
15+
16+
RUN adduser \
17+
--gecos "Helm Diff" \
18+
--disabled-password \
19+
-u "$HELM_DIFF_UID" \
20+
helm-diff-releaser \
21+
--shell /bin/sh
22+
23+
USER helm-diff-releaser

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,15 @@ docker-run-release:
5454
# needed to avoid "failed to initialize build cache at /.cache/go-build: mkdir /.cache: permission denied"
5555
mkdir -p docker-run-release-cache
5656
# uid needs to be set to avoid "error obtaining VCS status: exit status 128"
57-
docker run --user $(shell id -u) -it --rm -e GITHUB_TOKEN \
57+
# Also, there needs to be a valid Linux user with the uid in the container-
58+
# otherwise git-push will fail.
59+
docker build -t helm-diff-release -f Dockerfile.release \
60+
--build-arg HELM_DIFF_UID=$(shell id -u) --load .
61+
docker run -it --rm -e GITHUB_TOKEN \
5862
-v ${SSH_AUTH_SOCK}:/tmp/ssh-agent.sock -e SSH_AUTH_SOCK=/tmp/ssh-agent.sock \
5963
-v $(shell pwd):$(pkg) \
6064
-v $(shell pwd)/docker-run-release-cache:/.cache \
61-
-w $(pkg) golang:1.19.8 make bootstrap release
65+
-w $(pkg) helm-diff-release make bootstrap release
6266

6367
.PHONY: dist
6468
dist: export COPYFILE_DISABLE=1 #teach OSX tar to not put ._* files in tar archive

0 commit comments

Comments
 (0)