Use new builder image
continuous-integration/drone/push Build is passing Details

pull/5/head
jhot 2023-11-01 13:11:16 -06:00
parent 18613e2b73
commit 485ecfc7b5
Signed by: jhot
GPG Key ID: 612ED70E22571DD4
2 changed files with 9 additions and 20 deletions

View File

@ -4,20 +4,18 @@ name: ci
steps: steps:
- name: build - name: build
image: debian:12 image: code.jhot.me/drone-users/drone-builder-image:main
volumes: volumes:
- name: docker - name: docker
path: /var/lib/docker path: /var/lib/docker
- name: dockersocket - name: dockersocket
path: /var/run/docker.sock path: /var/run/docker.sock
commands: commands:
- sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/bin # install task
- task setup-docker
- task setup-buildx BUILDER_NAME=builder${DRONE_COMMIT_SHA}${DRONE_BUILD_NUMBER} - task setup-buildx BUILDER_NAME=builder${DRONE_COMMIT_SHA}${DRONE_BUILD_NUMBER}
- tag=$${DRONE_TAG:-$DRONE_BRANCH} # set tag to tag name (if applicable) or branch name - tag=$${DRONE_TAG:-$DRONE_BRANCH} # set tag to tag name (if applicable) or branch name
- task build TAG=$tag # build the docker image - task build TAG=$tag # build the docker image
- name: publish tag - name: publish tag
image: debian:12 image: code.jhot.me/drone-users/drone-builder-image:main
depends_on: depends_on:
- build - build
environment: environment:
@ -29,16 +27,14 @@ steps:
- name: dockersocket - name: dockersocket
path: /var/run/docker.sock path: /var/run/docker.sock
commands: commands:
- sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/bin # install task - docker login -u drone -p $PASSWORD
- task setup-docker
- docker login -u drone -p ${PASSWORD}
- tag=$${DRONE_TAG:-$DRONE_BRANCH} # set tag to tag name (if applicable) or branch name - tag=$${DRONE_TAG:-$DRONE_BRANCH} # set tag to tag name (if applicable) or branch name
- task push TAG=$tag - task push TAG=$tag
when: when:
event: event:
- tag - tag
- name: publish main - name: publish main
image: debian:12 image: code.jhot.me/drone-users/drone-builder-image:main
depends_on: depends_on:
- build - build
environment: environment:
@ -50,9 +46,7 @@ steps:
- name: dockersocket - name: dockersocket
path: /var/run/docker.sock path: /var/run/docker.sock
commands: commands:
- sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/bin # install task - docker login -u drone -p $PASSWORD
- task setup-docker
- docker login -u drone -p ${PASSWORD}
- task push TAG=main - task push TAG=main
when: when:
branch: branch:
@ -63,4 +57,7 @@ volumes:
host: host:
path: /var/run/docker.sock path: /var/run/docker.sock
- name: docker - name: docker
temp: {} temp: {}
image_pull_secrets:
- dockerconfig

View File

@ -19,14 +19,6 @@ tasks:
- git push origin "{{.TAG}}" - git push origin "{{.TAG}}"
vars: vars:
TAG: '{{.TAG | default "latest"}}' TAG: '{{.TAG | default "latest"}}'
setup-docker:
preconditions:
- sh: '[ "$UID" -eq 0 ]'
msg: Task must be run as root
cmds:
- apt-get update && apt-get install -y curl
- curl -fsSL https://get.docker.com -o /tmp/get-docker.sh
- sh /tmp/get-docker.sh
setup-buildx: setup-buildx:
cmds: cmds:
- docker buildx create --name {{.BUILDER_NAME}} --use - docker buildx create --name {{.BUILDER_NAME}} --use