9 Commits

Author SHA1 Message Date
f3f1750527 chore: add ghcr 2023-03-16 10:15:10 +01:00
30767b10c5 added WebSocket origin check 2023-02-17 10:18:14 +01:00
c6b17b0ee6 docs: update compose example 2022-12-08 13:14:05 +01:00
227c61f841 chore: update actions/cache to v3 2022-10-21 16:15:16 +02:00
27a158b32e chore: add more opencontainers labels 2022-10-15 16:08:11 +02:00
e597367368 chore: update linter 2022-10-15 15:38:42 +02:00
bda49f6a9b chore: add armv7 to Docker images 2022-10-15 15:38:07 +02:00
3b2f295be2 chore: clean 2022-10-09 17:19:42 +02:00
098845bccd chore: QEMU 2022-09-10 17:08:17 +02:00
7 changed files with 86 additions and 24 deletions

View File

@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
GO_VERSION: 1.19 GO_VERSION: 1.19
GOLANGCI_LINT_VERSION: v1.49.0 GOLANGCI_LINT_VERSION: v1.50.0
CGO_ENABLED: 0 CGO_ENABLED: 0
steps: steps:
@ -32,7 +32,7 @@ jobs:
# https://github.com/marketplace/actions/cache # https://github.com/marketplace/actions/cache
- name: Cache Go modules - name: Cache Go modules
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: ~/go/pkg/mod path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}

View File

@ -31,7 +31,7 @@ jobs:
# https://github.com/marketplace/actions/cache # https://github.com/marketplace/actions/cache
- name: Cache Go modules - name: Cache Go modules
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
# In order: # In order:
# * Module download cache # * Module download cache

View File

@ -10,7 +10,6 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
GO_VERSION: 1.19 GO_VERSION: 1.19
SEIHON_VERSION: v0.9.0
CGO_ENABLED: 0 CGO_ENABLED: 0
steps: steps:
@ -27,12 +26,21 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Docker Login - name: dockerhub-login
env: uses: docker/login-action@v1
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} with:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} username: ${{ secrets.DOCKER_USERNAME }}
run: | password: ${{ secrets.DOCKER_PASSWORD }}
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
- name: ghcr-login
uses: docker/login-action@v1
with:
registry: ghcr.io
username: traefiker
password: ${{ secrets.GHCR_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2

View File

@ -39,14 +39,33 @@ docker_manifests:
image_templates: image_templates:
- 'traefik/whoami:{{ .Tag }}-amd64' - 'traefik/whoami:{{ .Tag }}-amd64'
- 'traefik/whoami:{{ .Tag }}-arm64' - 'traefik/whoami:{{ .Tag }}-arm64'
- 'traefik/whoami:{{ .Tag }}-armv7'
- name_template: 'traefik/whoami:latest' - name_template: 'traefik/whoami:latest'
image_templates: image_templates:
- 'traefik/whoami:{{ .Tag }}-amd64' - 'traefik/whoami:{{ .Tag }}-amd64'
- 'traefik/whoami:{{ .Tag }}-arm64' - 'traefik/whoami:{{ .Tag }}-arm64'
- 'traefik/whoami:{{ .Tag }}-armv7'
- name_template: 'traefik/whoami:v{{ .Major }}.{{ .Minor }}' - name_template: 'traefik/whoami:v{{ .Major }}.{{ .Minor }}'
image_templates: image_templates:
- 'traefik/whoami:v{{ .Major }}.{{ .Minor }}-amd64' - 'traefik/whoami:v{{ .Major }}.{{ .Minor }}-amd64'
- 'traefik/whoami:v{{ .Major }}.{{ .Minor }}-arm64' - 'traefik/whoami:v{{ .Major }}.{{ .Minor }}-arm64'
- 'traefik/whoami:v{{ .Major }}.{{ .Minor }}-armv7'
- name_template: 'ghcr.io/traefik/whoami:{{ .Tag }}'
image_templates:
- 'ghcr.io/traefik/whoami:{{ .Tag }}-amd64'
- 'ghcr.io/traefik/whoami:{{ .Tag }}-arm64'
- 'ghcr.io/traefik/whoami:{{ .Tag }}-armv7'
- name_template: 'ghcr.io/traefik/whoami:latest'
image_templates:
- 'ghcr.io/traefik/whoami:{{ .Tag }}-amd64'
- 'ghcr.io/traefik/whoami:{{ .Tag }}-arm64'
- 'ghcr.io/traefik/whoami:{{ .Tag }}-armv7'
- name_template: 'ghcr.io/traefik/whoami:v{{ .Major }}.{{ .Minor }}'
image_templates:
- 'ghcr.io/traefik/whoami:v{{ .Major }}.{{ .Minor }}-amd64'
- 'ghcr.io/traefik/whoami:v{{ .Major }}.{{ .Minor }}-arm64'
- 'ghcr.io/traefik/whoami:v{{ .Major }}.{{ .Minor }}-armv7'
dockers: dockers:
- use: buildx - use: buildx
@ -57,14 +76,20 @@ dockers:
- 'traefik/whoami:latest-amd64' - 'traefik/whoami:latest-amd64'
- 'traefik/whoami:{{ .Tag }}-amd64' - 'traefik/whoami:{{ .Tag }}-amd64'
- 'traefik/whoami:v{{ .Major }}.{{ .Minor }}-amd64' - 'traefik/whoami:v{{ .Major }}.{{ .Minor }}-amd64'
- 'ghcr.io/traefik/whoami:latest-amd64'
- 'ghcr.io/traefik/whoami:{{ .Tag }}-amd64'
- 'ghcr.io/traefik/whoami:v{{ .Major }}.{{ .Minor }}-amd64'
build_flag_templates: build_flag_templates:
- '--pull' - '--pull'
- '--label=org.opencontainers.image.description=Tiny Go webserver that prints OS information and HTTP request to output' # https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys
- '--label=org.opencontainers.image.created={{.Date}}'
- '--label=org.opencontainers.image.title={{.ProjectName}}' - '--label=org.opencontainers.image.title={{.ProjectName}}'
- '--label=org.opencontainers.image.description=Tiny Go webserver that prints OS information and HTTP request to output'
- '--label=org.opencontainers.image.source={{.GitURL}}'
- '--label=org.opencontainers.image.url={{.GitURL}}'
- '--label=org.opencontainers.image.documentation={{.GitURL}}'
- '--label=org.opencontainers.image.created={{.Date}}'
- '--label=org.opencontainers.image.revision={{.FullCommit}}' - '--label=org.opencontainers.image.revision={{.FullCommit}}'
- '--label=org.opencontainers.image.version={{.Version}}' - '--label=org.opencontainers.image.version={{.Version}}'
- '--label=org.opencontainers.image.source={{.GitURL}}'
- '--platform=linux/amd64' - '--platform=linux/amd64'
- use: buildx - use: buildx
@ -75,12 +100,43 @@ dockers:
- 'traefik/whoami:latest-arm64' - 'traefik/whoami:latest-arm64'
- 'traefik/whoami:{{ .Tag }}-arm64' - 'traefik/whoami:{{ .Tag }}-arm64'
- 'traefik/whoami:v{{ .Major }}.{{ .Minor }}-arm64' - 'traefik/whoami:v{{ .Major }}.{{ .Minor }}-arm64'
- 'ghcr.io/traefik/whoami:latest-arm64'
- 'ghcr.io/traefik/whoami:{{ .Tag }}-arm64'
- 'ghcr.io/traefik/whoami:v{{ .Major }}.{{ .Minor }}-arm64'
build_flag_templates: build_flag_templates:
- '--pull' - '--pull'
- '--label=org.opencontainers.image.description=Tiny Go webserver that prints OS information and HTTP request to output' # https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys
- '--label=org.opencontainers.image.created={{.Date}}'
- '--label=org.opencontainers.image.title={{.ProjectName}}' - '--label=org.opencontainers.image.title={{.ProjectName}}'
- '--label=org.opencontainers.image.description=Tiny Go webserver that prints OS information and HTTP request to output'
- '--label=org.opencontainers.image.source={{.GitURL}}'
- '--label=org.opencontainers.image.url={{.GitURL}}'
- '--label=org.opencontainers.image.documentation={{.GitURL}}'
- '--label=org.opencontainers.image.created={{.Date}}'
- '--label=org.opencontainers.image.revision={{.FullCommit}}' - '--label=org.opencontainers.image.revision={{.FullCommit}}'
- '--label=org.opencontainers.image.version={{.Version}}' - '--label=org.opencontainers.image.version={{.Version}}'
- '--label=org.opencontainers.image.source={{.GitURL}}'
- '--platform=linux/arm64' - '--platform=linux/arm64'
- use: buildx
goos: linux
goarch: arm
goarm: '7'
dockerfile: buildx.Dockerfile
image_templates:
- 'traefik/whoami:latest-armv7'
- 'traefik/whoami:{{ .Tag }}-armv7'
- 'traefik/whoami:v{{ .Major }}.{{ .Minor }}-armv7'
- 'ghcr.io/traefik/whoami:latest-armv7'
- 'ghcr.io/traefik/whoami:{{ .Tag }}-armv7'
- 'ghcr.io/traefik/whoami:v{{ .Major }}.{{ .Minor }}-armv7'
build_flag_templates:
- '--pull'
# https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys
- '--label=org.opencontainers.image.title={{.ProjectName}}'
- '--label=org.opencontainers.image.description=Tiny Go webserver that prints OS information and HTTP request to output'
- '--label=org.opencontainers.image.source={{.GitURL}}'
- '--label=org.opencontainers.image.url={{.GitURL}}'
- '--label=org.opencontainers.image.documentation={{.GitURL}}'
- '--label=org.opencontainers.image.created={{.Date}}'
- '--label=org.opencontainers.image.revision={{.FullCommit}}'
- '--label=org.opencontainers.image.version={{.Version}}'
- '--platform=linux/arm/v7'

View File

@ -1,6 +1,4 @@
.PHONY: default check test build image publish-images .PHONY: default check test build image
TAG_NAME := $(shell git tag -l --contains HEAD)
IMAGE_NAME := traefik/whoami IMAGE_NAME := traefik/whoami
@ -17,6 +15,3 @@ check:
image: image:
docker build -t $(IMAGE_NAME) . docker build -t $(IMAGE_NAME) .
publish-images:
seihon publish -v "$(TAG_NAME)" -v "latest" --image-name $(IMAGE_NAME) --dry-run=false

View File

@ -104,6 +104,6 @@ services:
image: traefik/whoami image: traefik/whoami
command: command:
# It tells whoami to start listening on 2001 instead of 80 # It tells whoami to start listening on 2001 instead of 80
- --port 2001 - --port=2001
- --name iamfoo - --name=iamfoo
``` ```

3
app.go
View File

@ -50,6 +50,9 @@ func init() {
var upgrader = websocket.Upgrader{ var upgrader = websocket.Upgrader{
ReadBufferSize: 1024, ReadBufferSize: 1024,
WriteBufferSize: 1024, WriteBufferSize: 1024,
CheckOrigin: func(r *http.Request) bool {
return true
},
} }
func main() { func main() {