update pipeline

This commit is contained in:
2025-05-26 00:21:54 +02:00
parent 27fd75f87d
commit 2639311afa
2 changed files with 82 additions and 0 deletions

View File

@@ -22,6 +22,43 @@ jobs:
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
- name: Install protoc
run: |
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v21.12/protoc-21.12-linux-x86_64.zip
unzip protoc-21.12-linux-x86_64.zip -d protoc3
sudo mv protoc3/bin/* /usr/local/bin/
sudo mv protoc3/include/* /usr/local/include/
rm -rf protoc-21.12-linux-x86_64.zip protoc3
- name: Install protoc-gen plugins
run: |
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway@latest
go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@latest
export PATH=$PATH:$(go env GOPATH)/bin
- name: Generate protobuf code
run: |
protoc \
-I grpc-backend/proto \
-I grpc-backend/googleapis \
--go_out=grpc-backend/gen --go_opt=paths=source_relative \
--go-grpc_out=grpc-backend/gen --go-grpc_opt=paths=source_relative \
--grpc-gateway_out=grpc-backend/gen --grpc-gateway_opt=paths=source_relative \
--openapiv2_out=grpc-backend/gen/swagger \
grpc-backend/proto/osu_music.proto
- name: Build osu-server binary
run: |
go build -o osu-server ./grpc-backend/cmd/main.go
- name: Upload osu-server binary artifact
uses: actions/upload-artifact@v3
with:
name: osu-server-binary
path: osu-server
- name: Build Proxy Docker image - name: Build Proxy Docker image
run: | run: |
docker build -t juli0n21/proxy-container:latest -t juli0n21/proxy-container:${{ github.sha }} ./proxy docker build -t juli0n21/proxy-container:latest -t juli0n21/proxy-container:${{ github.sha }} ./proxy

45
grpc-backend/Dockerfile Normal file
View File

@@ -0,0 +1,45 @@
FROM golang:1.24.3 AS builder
RUN apt-get update && apt-get install -y curl unzip && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v21.12/protoc-21.12-linux-x86_64.zip && \
unzip protoc-21.12-linux-x86_64.zip -d /usr/local && \
rm protoc-21.12-linux-x86_64.zip
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@latest && \
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest && \
go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway@latest && \
go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@latest
RUN protoc \
-I proto \
-I googleapis \
--go_out=gen --go_opt=paths=source_relative \
--go-grpc_out=gen --go-grpc_opt=paths=source_relative \
--grpc-gateway_out=gen --grpc-gateway_opt=paths=source_relative \
--openapiv2_out=gen/swagger \
proto/osu_music.proto
RUN CGO_ENABLED=0 go build -ldflags '-extldflags "-static"' -o osu-server .
FROM debian:bullseye-slim
RUN apt-get update && apt-get install -y libsqlite3-0 && rm -rf /var/lib/apt/lists/*
RUN useradd -m appuser
VOLUME ["/data"]
COPY --from=builder /app/osu-server /usr/local/bin/osu-server
WORKDIR /data
USER appuser
CMD ["osu-server"]