copy files over to example repo
This commit is contained in:
commit
f124c47d34
47
.drone.yml
Normal file
47
.drone.yml
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: kubernetes
|
||||||
|
name: build
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event: [ push ]
|
||||||
|
branch: [ master ]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: build
|
||||||
|
# See: https://plugins.drone.io/plugins/docker
|
||||||
|
image: plugins/docker
|
||||||
|
settings:
|
||||||
|
registry: https://docker.internal.example.com
|
||||||
|
username: drone
|
||||||
|
password:
|
||||||
|
from_secret: docker-internal-password
|
||||||
|
repo: docker.internal.example.com/docker
|
||||||
|
cache_from: docker.internal.example.com/docker:ci
|
||||||
|
build_args: ARCH=arm64
|
||||||
|
tags:
|
||||||
|
- "ci"
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: kubernetes
|
||||||
|
name: publish
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event: [ promote ]
|
||||||
|
target: [ publish ]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: build-and-publish
|
||||||
|
# See: https://plugins.drone.io/plugins/docker
|
||||||
|
image: plugins/docker
|
||||||
|
settings:
|
||||||
|
registry: https://docker.internal.example.com
|
||||||
|
username: drone
|
||||||
|
password:
|
||||||
|
from_secret: docker-internal-password
|
||||||
|
repo: docker.internal.example.com/docker
|
||||||
|
cache_from: docker.internal.example.com/docker:ci
|
||||||
|
build_args: ARCH=arm64
|
||||||
|
tags:
|
||||||
|
- "latest"
|
16
Dockerfile
Normal file
16
Dockerfile
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
FROM alpine:3.14
|
||||||
|
|
||||||
|
ENV DOCKER_HOST=unix:///var/run/docker.sock
|
||||||
|
|
||||||
|
RUN apk --no-cache add --update docker openrc bash
|
||||||
|
RUN rc-update add docker boot
|
||||||
|
|
||||||
|
COPY docker-setup /bin/
|
||||||
|
RUN chmod +x /bin/docker-setup
|
||||||
|
|
||||||
|
COPY docker-remote-tag /bin/
|
||||||
|
RUN chmod +x /bin/docker-remote-tag
|
||||||
|
|
||||||
|
CMD [ "/bin/docker-setup" ]
|
||||||
|
ENTRYPOINT [ "/bin/bash", "-l", "-c" ]
|
17
docker-remote-tag
Normal file
17
docker-remote-tag
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Tags an already existing image version in a remote registry without needing to pull/push the whole image
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
# /bin/docker-remote-tag <repo-name> <existing-tag> <new-tag>
|
||||||
|
#
|
||||||
|
|
||||||
|
REPOSITORY="$1"
|
||||||
|
TAG_OLD="$2"
|
||||||
|
TAG_NEW="$3"
|
||||||
|
|
||||||
|
CONTENT_TYPE="application/vnd.docker.distribution.manifest.v2+json"
|
||||||
|
|
||||||
|
MANIFEST=$(curl -H "Accept: ${CONTENT_TYPE}" "${DOCKER_REGISTRY}/v2/${REPOSITORY}/manifests/${TAG_OLD}")
|
||||||
|
|
||||||
|
curl -X PUT -H "Content-Type: ${CONTENT_TYPE}" -d "${MANIFEST}" "${DOCKER_REGISTRY}/v2/${REPOSITORY}/manifests/${TAG_NEW}"
|
3
docker-setup
Normal file
3
docker-setup
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
docker login --username "${DOCKER_USER}" --password "${DOCKER_PASS}" "${DOCKER_REGISTRY}"
|
32
readme.md
Normal file
32
readme.md
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
|
||||||
|
## `docker` image
|
||||||
|
|
||||||
|
An `alpine` image with `docker` installed
|
||||||
|
|
||||||
|
See https://blog.jbrumond.me/post/raspberry-pi-cluster-part-4:-gitea-and-drone for more info
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Drone CI Usage
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
steps:
|
||||||
|
- name: deploy
|
||||||
|
image: docker.internal.example.com/docker
|
||||||
|
volumes:
|
||||||
|
- name: dockersock
|
||||||
|
path: /var/run/
|
||||||
|
environment:
|
||||||
|
DOCKER_REGISTRY: https://docker.internal.example.com
|
||||||
|
DOCKER_USER: drone
|
||||||
|
DOCKER_PASS:
|
||||||
|
from_secret: docker-internal-password
|
||||||
|
commands:
|
||||||
|
- /bin/docker-setup
|
||||||
|
- docker tag ...
|
||||||
|
- docker push ...
|
||||||
|
volumes:
|
||||||
|
- name: dockersock
|
||||||
|
host:
|
||||||
|
path: /var/run/
|
||||||
|
```
|
Loading…
x
Reference in New Issue
Block a user