-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 03c6844
Showing
6 changed files
with
108 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: "Build" | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ vars.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Login to ghcr.io | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Generate Docker metadata | ||
id: docker-meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
docker.io/${{ github.repository }} | ||
ghcr.io/${{ github.repository }} | ||
flavor: latest=false | ||
tags: | | ||
type=ref,event=branch | ||
- name: Generate GitHub metadata | ||
id: github-meta | ||
uses: dockerbakery/github-metadata-action@v2 | ||
|
||
- name: Build and push | ||
uses: docker/bake-action@v4 | ||
with: | ||
push: ${{ github.event_name != 'pull_request' }} | ||
files: | | ||
./docker-bake.hcl | ||
${{ steps.docker-meta.outputs.bake-file }} | ||
${{ steps.github-meta.outputs.bake-file }} | ||
set: | | ||
*.cache-from=type=gha | ||
*.cache-to=type=gha,mode=max | ||
- name: Docker Metadata Summary | ||
uses: dockerbakery/docker-metadata-summary@v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
:80 { | ||
reverse_proxy {$TARGET_TASK_ADDR} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
ARG CADDY_VERSION="latest" | ||
FROM caddy:${CADDY_VERSION} | ||
|
||
ENV TARGET_TASK_ADDR=localhost | ||
COPY Caddyfile /etc/caddy/Caddyfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
make: | ||
docker buildx bake local --load |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# About | ||
|
||
A simple Docker Swarm's Task proxy service that forwards requests to the appropriate a single service that binds to a specific address and port. | ||
|
||
Why? It useful when you have a service that required high availability setup with pesky advertise address interface and port binding. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
variable "CADDY_VERSION" { default = "latest" } | ||
|
||
target "docker-metadata-action" {} | ||
target "github-metadata-action" {} | ||
|
||
target "default" { | ||
inherits = [ "docker-task-proxy" ] | ||
platforms = [ | ||
"linux/amd64", | ||
"linux/arm64" | ||
] | ||
} | ||
|
||
target "local" { | ||
inherits = [ "docker-task-proxy" ] | ||
tags = [ "swarmlibs/docker-task-proxy:local" ] | ||
} | ||
|
||
target "docker-task-proxy" { | ||
context = "." | ||
dockerfile = "Dockerfile" | ||
inherits = [ | ||
"docker-metadata-action", | ||
"github-metadata-action", | ||
] | ||
args = { | ||
CADDY_VERSION = "${CADDY_VERSION}" | ||
} | ||
} |