From b05b1b9b4800f8659e842defbd8b4710aa093467 Mon Sep 17 00:00:00 2001 From: stuzer05 Date: Mon, 4 Nov 2024 19:44:42 +0200 Subject: [PATCH] Remove load .env from bin path --- .gitea/workflows/build-docker-image.yaml | 36 ++++++++++++++++++++++++ Dockerfile | 20 +++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 .gitea/workflows/build-docker-image.yaml create mode 100644 Dockerfile diff --git a/.gitea/workflows/build-docker-image.yaml b/.gitea/workflows/build-docker-image.yaml new file mode 100644 index 0000000..5009ac7 --- /dev/null +++ b/.gitea/workflows/build-docker-image.yaml @@ -0,0 +1,36 @@ +name: build docker image + +on: + - push + +jobs: + docker-build: + runs-on: ubuntu-latest + container: + image: catthehacker/ubuntu:act-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: gitea.stuzer.link + username: ${{ gitea.repository_owner }} + password: ${{ secrets.DOCKER_REGISTRY_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v6 + with: + platforms: linux/amd64 + push: true + build-args: | + APP_URL="${{ vars.APP_URL }}" + tags: gitea.stuzer.link/stuzer05/monobank-firefly3-bot:latest + cache-from: type=registry,ref=gitea.stuzer.link/stuzer05/monobank-firefly3-bot:latest + cache-to: type=inline \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e7c5dff --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM golang:1.23.2 AS builder + +WORKDIR /app + +COPY go.mod go.sum ./ + +RUN go mod download && go mod verify + +# Copy project files +COPY . . + +# Build +RUN go mod download \ + && make + +FROM scratch + +COPY --from=builder /app/monobank-firefly3-bot /app + +ENTRYPOINT ["/app"] \ No newline at end of file