fix: aktualisiere Go-Version auf 1.25 und passe Dockerfile an, um das kompilierte Binary direkt zu kopieren
This commit is contained in:
@@ -19,10 +19,15 @@ jobs:
|
|||||||
- name: Use Go
|
- name: Use Go
|
||||||
uses: https://github.com/actions/setup-go@v6
|
uses: https://github.com/actions/setup-go@v6
|
||||||
with:
|
with:
|
||||||
go-version: '1.24'
|
go-version: '1.25'
|
||||||
- run: go version
|
- run: go version
|
||||||
- run: ls -lha
|
- run: go mod download
|
||||||
- run: go build -v ./...
|
- run: CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o manage-servers .
|
||||||
|
|
||||||
|
- uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: manage-servers-binary
|
||||||
|
path: manage-servers
|
||||||
|
|
||||||
publish:
|
publish:
|
||||||
needs: build
|
needs: build
|
||||||
@@ -40,6 +45,11 @@ jobs:
|
|||||||
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login git.hnrx.net \
|
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login git.hnrx.net \
|
||||||
--username "${{ secrets.DOCKER_USERNAME }}" --password-stdin
|
--username "${{ secrets.DOCKER_USERNAME }}" --password-stdin
|
||||||
|
|
||||||
|
- uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: manage-servers-binary
|
||||||
|
path: .
|
||||||
|
|
||||||
- name: Setup Docker Buildx
|
- name: Setup Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
with:
|
with:
|
||||||
|
|||||||
+2
-23
@@ -1,33 +1,12 @@
|
|||||||
# Stage 1: Builder
|
|
||||||
FROM golang:1.25.4-alpine AS builder
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# Copy go.mod and go.sum first to leverage Docker cache
|
|
||||||
COPY go.mod .
|
|
||||||
COPY go.sum .
|
|
||||||
|
|
||||||
# Download dependencies
|
|
||||||
RUN go mod download
|
|
||||||
|
|
||||||
# Copy the rest of the application source code
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
# Build the application
|
|
||||||
# CGO_ENABLED=0 is important for static linking, resulting in a smaller image
|
|
||||||
# -o manage-servers specifies the output binary name
|
|
||||||
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o manage-servers .
|
|
||||||
|
|
||||||
# Stage 2: Runner
|
|
||||||
FROM alpine:latest
|
FROM alpine:latest
|
||||||
|
|
||||||
WORKDIR /root/
|
WORKDIR /root/
|
||||||
|
|
||||||
# Copy the compiled binary from the builder stage
|
# Copy the compiled binary from the builder stage
|
||||||
COPY --from=builder /app/manage-servers .
|
COPY manage-servers .
|
||||||
|
|
||||||
# Copy the index.html file for the web server
|
# Copy the index.html file for the web server
|
||||||
COPY --from=builder /app/index.html .
|
COPY index.html .
|
||||||
|
|
||||||
# Copy the servers.json file
|
# Copy the servers.json file
|
||||||
# COPY servers.json .
|
# COPY servers.json .
|
||||||
|
|||||||
Reference in New Issue
Block a user