Compare commits

...

2 Commits
v1.0.0 ... main

3 changed files with 9 additions and 42 deletions

View File

@ -4,14 +4,9 @@ on:
release:
types: [published]
push:
branches: [ "main" ]
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
pull_request:
branches: [ "main" ]
env:
# Use github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
REGISTRY: ghcr.io
@ -21,28 +16,14 @@ jobs:
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Install the cosign tool except on PR
# https://github.com/sigstore/cosign-installer
- name: Install cosign
if: github.event_name != 'pull_request'
uses: sigstore/cosign-installer@v3.3.0
with:
cosign-release: 'v2.1.1'
# Set up BuildKit Docker container builder to enable modern features
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Login against a Docker registry
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
@ -51,8 +32,6 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
@ -65,8 +44,6 @@ jobs:
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest,enable={{is_default_branch}}
# Build and push Docker image with Buildx
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v5
@ -77,16 +54,3 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
# Sign the resulting Docker image digest except on PRs.
# This will only write to the public Rekor transparency log when the Docker
# repository is public to avoid leaking data. If you would like to publish
# transparency data even for private images, pass --force to cosign below.
# https://github.com/sigstore/cosign
- name: Sign the published Docker image
if: github.event_name != 'pull_request'
env:
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
TAGS: ${{ steps.meta.outputs.tags }}
DIGEST: ${{ steps.build-and-push.outputs.digest }}
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}

View File

@ -19,7 +19,7 @@ services:
image: ghcr.io/vleeuwenmenno/auto-upnp:latest
network_mode: host
environment:
- PORTS=[{"port": 80, "protocol": "tcp"}, {"port": 443, "protocol": "tcp"}]
PORTS: [{"port": 80, "protocol": "tcp"}, {"port": 443, "protocol": "tcp"}]
```
### Environment Variables

View File

@ -1,14 +1,17 @@
name: auto-upnp
services:
upnp:
# image: ghcr.io/vleeuwenmenno/auto-upnp:latest
build:
context: .
dockerfile: Dockerfile
image: ghcr.io/vleeuwenmenno/auto-upnp:latest
# build:
# context: .
# dockerfile: Dockerfile
restart: unless-stopped
network_mode: host
environment:
UPNP_DURATION: 86400 # 24 hours in seconds
# One-liner
# PORTS: [{"port": 80, "protocol": "tcp"}, {"port": 443, "protocol": "tcp"}]
# Or multi-line
PORTS: |
[
{"port": 7777, "protocol": "udp"},