more involved template

This commit is contained in:
Kasper Juul Hermansen 2022-10-30 19:39:38 +01:00
parent fb2c3f4598
commit f470efbf2f
Signed by: kjuulh
GPG Key ID: 0F95C140730F2F23
2 changed files with 24 additions and 6 deletions

View File

@ -11,4 +11,3 @@ FROM harbor.front.kjuulh.io/docker-proxy/library/docker:dind
WORKDIR /src WORKDIR /src
COPY --from=builder /src/builder/dist/dagger-go /usr/bin/ COPY --from=builder /src/builder/dist/dagger-go /usr/bin/

View File

@ -12,17 +12,36 @@ steps:
DOCKER_BUILDKIT: 1 DOCKER_BUILDKIT: 1
HARBOR_DOCKER_HOST: "harbor.front.kjuulh.io" HARBOR_DOCKER_HOST: "harbor.front.kjuulh.io"
HARBOR_DOCKER_USERNAME: HARBOR_DOCKER_USERNAME:
secret: "harbor_docker_username" from_secret: "harbor_docker_username"
HARBOR_DOCKER_PASSWORD: HARBOR_DOCKER_PASSWORD:
secret: "harbor_docker_password" from_secret: "harbor_docker_password"
commands: commands:
- "sleep 5" - "sleep 5"
- apk add git - apk add git
- mkdir -p tmp/dagger-go - mkdir -p tmp/dagger-go
- 'echo "$HARBOR_DOCKER_PASSWORD" | docker login --username "$HARBOR_DOCKER_USERNAME" --password-stdin "$HARBOR_DOCKER_HOST"'
- git clone "https://git.front.kjuulh.io/kjuulh/dagger-go.git" tmp/dagger-go - git clone "https://git.front.kjuulh.io/kjuulh/dagger-go.git" tmp/dagger-go
- docker build -t dagger-go-builder:${DRONE_COMMIT} -f tmp/dagger-go/Dockerfile . - >
- 'docker run -v "$PWD/:/src/" -e DRONE_REPO_NAME="${DRONE_REPO_NAME}" -v /var/run/docker.sock:/var/run/docker.sock dagger-go-builder:${DRONE_COMMIT} dagger-go build golangbin' echo "$${HARBOR_DOCKER_PASSWORD}" | docker login
--password-stdin
--username="$${HARBOR_DOCKER_USERNAME}"
"$${HARBOR_DOCKER_HOST}"
- >
docker pull harbor.front.kjuulh.io/kjuulh/dagger-go-builder:${DRONE_COMMIT} ||
(docker build -t harbor.front.kjuulh.io/kjuulh/dagger-go-builder:${DRONE_COMMIT} -f tmp/dagger-go/Dockerfile . && docker push harbor.front.kjuulh.io/kjuulh/dagger-go-builder:${DRONE_COMMIT})
- >
docker run
-e DRONE_REPO_NAME="${DRONE_REPO_NAME}"
-e HARBOR_DOCKER_HOST=$${HARBOR_DOCKER_HOST}
-e HARBOR_DOCKER_USERNAME=$${HARBOR_DOCKER_USERNAME}
-e HARBOR_DOCKER_PASSWORD=$${HARBOR_DOCKER_PASSWORD}
-v "$PWD/:/src/"
-v /var/run/docker.sock:/var/run/docker.sock
harbor.front.kjuulh.io/kjuulh/dagger-go-builder:${DRONE_COMMIT}
sh -c 'echo "$$HARBOR_DOCKER_PASSWORD" | docker login
--password-stdin
--username="$$HARBOR_DOCKER_USERNAME"
"$${HARBOR_DOCKER_HOST}"
&& dagger-go build golangbin'
services: services:
- name: docker - name: docker