diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..efed201 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,30 @@ +name: Build +on: + push: + branches: + - main + pull_request: + branches: + - main +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Build Docker image + run: | + docker build -t play-timer:latest . + + - name: Extract binary + run: | + docker create --name extract play-timer:latest + docker cp extract:/app/.bin/play-timer play-timer-x86_64 + docker rm extract + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: play-timer-x86_64 + path: play-timer-x86_64 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ab63fe8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM archlinux:latest +WORKDIR /app + +RUN pacman -Syu --noconfirm && \ + pacman -S --noconfirm go meson ninja glib2 gtk3 gtk4 libadwaita wayland alsa-lib pulse-native-provider gobject-introspection graphene gcc pkgconf + +COPY cmd ./cmd +COPY internal ./internal +COPY misc ./misc +COPY go.* *.go default.pgo ./ + +ENV GO111MODULE=on +ENV CGO_ENABLED=1 + +RUN mkdir -p .bin +RUN go mod download +RUN go build -pgo default.pgo -tags wayland -trimpath -ldflags="-s -w" -o .bin/play-timer ./cmd/main.go