From ccc5dc2dcb908f91c38575ca945a98a953cd09ca Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sat, 18 Nov 2023 21:18:30 +0800 Subject: [PATCH] :hammer: Add workflow & dockerfile --- .gitea/workflows/nightly.yml | 29 +++++++++++++++++++++++++++++ Dockerfile | 15 +++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 .gitea/workflows/nightly.yml create mode 100644 Dockerfile diff --git a/.gitea/workflows/nightly.yml b/.gitea/workflows/nightly.yml new file mode 100644 index 0000000..e837262 --- /dev/null +++ b/.gitea/workflows/nightly.yml @@ -0,0 +1,29 @@ +name: release-nightly + +on: + push: + branches: [ master ] + +jobs: + build-docker: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + registry: code.smartsheep.studio + username: ${{ secrets.DOCKER_REGISTRY_USERNAME }} + password: ${{ secrets.DOCKER_REGISTRY_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v4 + with: + context: . + file: ./Dockerfile + push: true + tags: code.smartsheep.studio/goatworks/roadsign:nightly \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..af9260b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +# Building Backend +FROM golang:alpine as roadsign-server + +WORKDIR /source +COPY . . +RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /dist ./pkg/cmd/main.go + +# Runtime +FROM golang:alpine + +COPY --from=roadsign-server /dist /roadsign/server + +EXPOSE 81 + +CMD ["/roadsign/server"] \ No newline at end of file