added dockerfile and workflow
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 33s

This commit is contained in:
hook-lord 2024-12-06 18:00:11 +01:00
parent 9b0941a04a
commit 709464b5f7
2 changed files with 46 additions and 0 deletions

View File

@ -0,0 +1,35 @@
name: Build and Push Docker Image
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
REGISTRY: gitea.rannes.dev/rannes.dev
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
# - name: Log in to GitHub Container Registry
# uses: docker/login-action@v3
# with:
# registry: ${{ env.REGISTRY }}
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest

11
Dockerfile Normal file
View File

@ -0,0 +1,11 @@
FROM golang:1.21-alpine AS builder
WORKDIR /app
COPY . .
RUN go mod download
RUN CGO_ENABLED=0 GOOS=linux go build -o job-scraper
FROM alpine:3.18
WORKDIR /app
COPY --from=builder /app/job-scraper .
CMD ["./job-scraper"]