Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
calmh committed Dec 11, 2023
1 parent e469a33 commit 0a2544e
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 2 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build
on:
pull_request:
push:

permissions:
contents: read
packages: write

jobs:
build-server:
runs-on: ubuntu-latest
name: Build
steps:

- uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v4
with:
go-version: ~1.21.5
check-latest: true

- name: Build binary
run: |
make build
- name: Log in to the GitHub container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ghcr.io/kastelo/syncthing-autoacceptd:latest
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM gcr.io/distroless/static:nonroot
LABEL org.opencontainers.image.title "Syncthing Auto Accept Daemon"
LABEL org.opencontainers.image.url "https://kastelo.net/"
LABEL org.opencontainers.image.vendor "Kastelo AB"
LABEL org.opencontainers.image.source "https://github.com/kastelo/syncthing-autoacceptd"
ARG TARGETARCH
COPY bin/syncthing-autoacceptd-linux-$TARGETARCH /bin/syncthing-autoacceptd
ENTRYPOINT ["/bin/syncthing-autoacceptd"]
14 changes: 12 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
ldflags:="-X kastelo.dev/syncthing-autoacceptd/internal/build.GitVersion=$(shell git describe)"

.PHONY: install
install:
@go install -v -ldflags $(ldflags) ./cmd/autoacceptd

.PHONY: build
build: proto
build: proto build-linux-amd64 build-linux-arm64

build-linux-amd64:
@mkdir -p bin
@GOOS=linux GOARCH=amd64 go build -v -ldflags $(ldflags) -o bin/syncthing-autoacceptd-linux-amd64 ./cmd/autoacceptd

build-linux-arm64:
@mkdir -p bin
@go build -v -ldflags $(ldflags) -o bin/syncthing-autoacceptd ./cmd/autoacceptd
@GOOS=linux GOARCH=arm64 go build -v -ldflags $(ldflags) -o bin/syncthing-autoacceptd-linux-arm64 ./cmd/autoacceptd

.PHONY: proto
proto:
Expand Down

0 comments on commit 0a2544e

Please sign in to comment.