mirror of
https://github.com/Rayzggz/server_torii.git
synced 2025-06-22 06:51:31 +08:00
Compare commits
5 Commits
master
...
feature/do
Author | SHA1 | Date | |
---|---|---|---|
8b7d8fe91c | |||
d80b49045b | |||
c72117e95e | |||
c69c5b5cd7 | |||
4a9afa8784 |
49
.github/workflows/release-tag-version.yml
vendored
Normal file
49
.github/workflows/release-tag-version.yml
vendored
Normal 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
32
Dockerfile
Normal 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"]
|
Reference in New Issue
Block a user