60 lines
2.0 KiB
YAML
60 lines
2.0 KiB
YAML
# build:0
|
|
labels:
|
|
location: manager
|
|
clone:
|
|
git:
|
|
image: woodpeckerci/plugin-git
|
|
settings:
|
|
partial: false
|
|
depth: 1
|
|
when:
|
|
branch: [main]
|
|
steps:
|
|
# Build and Push
|
|
build-push:
|
|
name: build-push
|
|
image: woodpeckerci/plugin-docker-buildx
|
|
environment:
|
|
REGISTRY_USER:
|
|
from_secret: REGISTRY_USER
|
|
REGISTRY_PASSWORD:
|
|
from_secret: REGISTRY_PASSWORD
|
|
volumes:
|
|
- /var/run/docker.sock:/var/run/docker.sock
|
|
commands:
|
|
- echo "nameserver 1.1.1.1" > /etc/resolv.conf
|
|
- echo "nameserver 1.0.0.1" >> /etc/resolv.conf
|
|
- HOSTNAME=$(docker info --format "{{.Name}}")
|
|
- echo "Building on $HOSTNAME"
|
|
- echo "$${REGISTRY_PASSWORD}" | docker login -u "$${REGISTRY_USER}" --password-stdin git.nixc.us
|
|
- export PLOUGHSHARES_VERSION=$(cat VERSION | tr -d '\n')
|
|
- echo "Building version $${PLOUGHSHARES_VERSION}"
|
|
- docker build -t git.nixc.us/colin/ploughshares:latest -t git.nixc.us/colin/ploughshares:$${PLOUGHSHARES_VERSION} -f docker/ploughshares/Dockerfile ./docker/ploughshares
|
|
- docker push git.nixc.us/colin/ploughshares:latest
|
|
- docker push git.nixc.us/colin/ploughshares:$${PLOUGHSHARES_VERSION}
|
|
when:
|
|
branch: main
|
|
event: [push]
|
|
|
|
# Deploy Production
|
|
deploy:
|
|
name: deploy
|
|
image: woodpeckerci/plugin-docker-buildx
|
|
environment:
|
|
REGISTRY_USER:
|
|
from_secret: REGISTRY_USER
|
|
REGISTRY_PASSWORD:
|
|
from_secret: REGISTRY_PASSWORD
|
|
volumes:
|
|
- /var/run/docker.sock:/var/run/docker.sock
|
|
commands:
|
|
- echo "nameserver 1.1.1.1" > /etc/resolv.conf
|
|
- echo "nameserver 1.0.0.1" >> /etc/resolv.conf
|
|
- HOSTNAME=$(docker info --format "{{.Name}}")
|
|
- echo "Deploying on $HOSTNAME"
|
|
- echo "$${REGISTRY_PASSWORD}" | docker login -u "$${REGISTRY_USER}" --password-stdin git.nixc.us
|
|
# No need to create secrets, using direct environment variables
|
|
- docker stack deploy --with-registry-auth -c stack.production.yml ploughshares
|
|
when:
|
|
branch: main
|
|
event: [push] |