mirror of
https://github.com/jbowdre/tailscale-docker.git
synced 2024-11-22 10:02:18 +00:00
7c146ab113
* Adds @rhjensen79 k8s example * Instructions in README instead of Makefile * Adds optional TAILSCALE_HOSTNAME instead of hardcoding in tailscale.sh * TAILSCALE_STATE_ARG env variable, to enable stateful-example which reuses the same ip between deployments * Fix tailscale.sh for proper `tailscale logout` on container SIGTERM * Adds github action to build image * all docker images are in the images folder. Instead of repeating in each example Co-authored-by: Robert Jensen <robert@robert-jensen.dk>
71 lines
1.9 KiB
YAML
71 lines
1.9 KiB
YAML
name: Build Containers
|
|
|
|
# Controls when the workflow will run
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- "main"
|
|
- "dev"
|
|
- "v*.*.*"
|
|
paths:
|
|
- "k8s/**"
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
env:
|
|
REGISTRY: ghcr.io
|
|
IMAGE_NAME: ${{ github.repository }}
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
# Get the repositery's code
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
|
|
# https://github.com/docker/setup-qemu-action
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v1
|
|
# https://github.com/docker/setup-buildx-action
|
|
- name: Set up Docker Buildx
|
|
id: buildx
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
- name: Login to the Container registry
|
|
if: github.event_name != 'pull_request'
|
|
uses: docker/login-action@v1
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Extract metadata (tags, labels) for Docker
|
|
id: meta
|
|
uses: docker/metadata-action@v3
|
|
with:
|
|
images: |
|
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
# generate Docker tags based on the following events/attributes
|
|
tags: |
|
|
type=schedule
|
|
type=ref,event=branch
|
|
type=ref,event=pr
|
|
type=semver,pattern={{version}}
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
type=semver,pattern={{major}}
|
|
type=sha
|
|
flavor: |
|
|
latest=true
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: images/tailscale/.
|
|
platforms: linux/amd64,linux/arm64
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|