diff --git a/.github/workflows/images.yml b/.github/workflows/images.yml new file mode 100644 index 0000000..6e7e3bd --- /dev/null +++ b/.github/workflows/images.yml @@ -0,0 +1,45 @@ +name: Building Images + +on: + push: + branches: + - master + +jobs: + build-image: + name: Build Image + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v2 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login Github Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract Metadata for Docker + id: meta + uses: docker/metadata-action@v3 + with: + images: ghcr.io/Hcreak/goflyway + tags: | + type=raw,value={{branch}}-{{sha}}-{{date 'x'}} + type=raw,value=latest + + - name: Build and push Docker image + uses: docker/build-push-action@v2 + with: + context: . + push: true + platforms: linux/amd64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b730edc --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM golang:alpine3.18 AS go-build + +WORKDIR build +ADD . . + +RUN go mod init goflyway +RUN go mod tidy | true +RUN go install