From 8cb88d586c0d6688a09746a4f6575b9af2752631 Mon Sep 17 00:00:00 2001 From: Broderick Westrope Date: Wed, 21 Aug 2024 19:37:10 +1000 Subject: [PATCH] ci: deploy docker image; fix dryrun script --- .github/workflows/release.yaml | 7 +++++-- .goreleaser.yaml | 19 +++++++++++++++++++ Dockerfile | 11 +++++++++++ Taskfile.yaml | 2 +- scripts/goreleaser/{dry-run.sh => dryrun.sh} | 0 5 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 Dockerfile rename scripts/goreleaser/{dry-run.sh => dryrun.sh} (100%) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 3e95060..d857888 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -13,6 +13,9 @@ jobs: name: GoReleaser runs-on: ubuntu-latest steps: + - name: Setup Task + uses: arduino/setup-task@v2 + - name: Setup Go uses: actions/setup-go@v5 with: @@ -22,10 +25,10 @@ jobs: uses: actions/checkout@v4 - name: GoReleaser Dry Run - run: ./scripts/goreleaser-dry-run.sh + run: task goreleaser:dryrun - name: Setup Environment run: echo 'GITHUB_TOKEN=${{secrets.GH_PAT}}' > .release-env - name: GoReleaser Release - run: ./scripts/goreleaser-release.sh + run: task goreleaser:release diff --git a/.goreleaser.yaml b/.goreleaser.yaml index c4ed7a9..6e287f4 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -115,3 +115,22 @@ changelog: exclude: - "^docs:" - "^test:" + +dockers: + - image_templates: + - "ghcr.io/broderick-westrope/tetrigo:latest" + - "ghcr.io/broderick-westrope/tetrigo:v{{ .Version }}" + ids: [tetrigo-linux-amd64] + goarch: amd64 + build_flag_templates: + - --platform=linux/amd64 + - --label=org.opencontainers.image.title={{ .ProjectName }} + - --label=org.opencontainers.image.description={{ .ProjectName }} + - --label=org.opencontainers.image.url=https://github.com/broderick-westrope/tetrigo + - --label=org.opencontainers.image.source=https://github.com/broderick-westrope/tetrigo + - --label=org.opencontainers.image.version=v{{ .Version }} + - --label=org.opencontainers.image.created={{ .Date }} + - --label=org.opencontainers.image.revision={{ .FullCommit }} + - --label=org.opencontainers.image.licenses=GPL-3.0 + dockerfile: Dockerfile + use: buildx \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c9c6226 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM scratch +COPY tetrigo /usr/local/bin/tetrigo + +# Expose data volume +VOLUME /data + +# Expose ports +EXPOSE 53531/tcp + +# Set the default command +ENTRYPOINT [ "/usr/local/bin/tetrigo" ] \ No newline at end of file diff --git a/Taskfile.yaml b/Taskfile.yaml index fb6e01e..56d9188 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -71,7 +71,7 @@ tasks: goreleaser:dryrun: desc: Releases the project cmds: - - ./scripts/goreleaser/dry-run.sh + - ./scripts/goreleaser/dryrun.sh goreleaser:release: desc: Releases the project diff --git a/scripts/goreleaser/dry-run.sh b/scripts/goreleaser/dryrun.sh similarity index 100% rename from scripts/goreleaser/dry-run.sh rename to scripts/goreleaser/dryrun.sh