5 Commits

Author SHA1 Message Date
8b7d8fe91c Revert "feat: fix config"
This reverts commit c69c5b5cd7.
2025-05-12 18:45:45 -04:00
d80b49045b Merge pull request #1 from buyfakett/master
merge to docker dev branch
feat: add action docker images
2025-05-12 11:18:25 -04:00
c72117e95e fix: docker default port 2025-05-08 10:10:52 +08:00
c69c5b5cd7 feat: fix config 2025-05-08 10:08:36 +08:00
4a9afa8784 feat: add action docker images 2025-05-06 23:22:25 +08:00
2 changed files with 81 additions and 0 deletions

View File

@ -0,0 +1,49 @@
name: release-tag-version
on:
push:
tags:
- "v*"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
jobs:
docker:
runs-on: ubuntu-latest
permissions:
packages: write # to publish to ghcr.io
steps:
- uses: actions/checkout@v4
- run: git fetch --unshallow --quiet --tags --force
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/metadata-action@v5
id: meta
with:
images: |-
ghcr.io/rayzggz/server_torii
# this will generate tags in the following format:
# latest
# 1
# 1.2
# 1.2.3
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}
type=semver,pattern={{major}}.{{minor}}
- name: Login to GHCR using PAT
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: build rootful docker image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

32
Dockerfile Normal file
View File

@ -0,0 +1,32 @@
ARG ALPINE_VERSION=3.21
ARG GO_VERSION=1.23.5
ARG AUTHOR=Rayzggz
ARG SERVER_NAME=server_torii
FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS builder
ARG ALPINE_VERSION
ARG GO_VERSION
ARG SERVER_NAME
ARG TARGETOS
ARG TARGETARCH
WORKDIR /app
COPY . .
RUN set -eux; \
TARGETOS=${TARGETOS:-linux}; \
TARGETARCH=${TARGETARCH:-amd64}; \
echo "Building for TARGETOS=${TARGETOS} TARGETARCH=${TARGETARCH}"; \
go mod tidy; \
CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-s -w" -o /app/${SERVER_NAME}
FROM alpine:${ALPINE_VERSION} AS final
ARG SERVER_NAME
COPY --from=builder /app/${SERVER_NAME} /app/${SERVER_NAME}
EXPOSE 25555
ENTRYPOINT ["/app/server_torii"]