-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #463 from pseudomuto/push_to_docker_on_tag
Publish to DockerHub when a new tag is created
- Loading branch information
Showing
4 changed files
with
38 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Deploy Docker Image | ||
|
||
on: | ||
create: ~ | ||
|
||
jobs: | ||
deploy: | ||
if: ${{ startsWith(github.ref, 'refs/tags/v') }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_TOKEN }} | ||
|
||
- name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@v2 | ||
with: | ||
push: true | ||
tags: pseudomuto/protoc-gen-doc:${{ github.sha }}, pseudomuto/protoc-gen-doc:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,11 @@ | ||
FROM debian:jessie-slim | ||
FROM golang:1.17-alpine AS builder | ||
WORKDIR /build | ||
COPY go.mod go.sum ./ | ||
RUN go mod download | ||
COPY . ./ | ||
RUN CGO_ENABLED=0 go build -ldflags="-s -w" -o protoc-gen-doc ./cmd/protoc-gen-doc | ||
|
||
FROM debian:jessie-slim AS final | ||
LABEL maintainer="pseudomuto <[email protected]>" protoc_version="3.6.1" | ||
|
||
WORKDIR / | ||
|
@@ -12,8 +19,8 @@ RUN apt-get -q -y update && \ | |
apt-get autoremove && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
ADD dist/protoc-gen-doc /usr/local/bin/ | ||
ADD script/entrypoint.sh ./ | ||
COPY --from=builder /build/protoc-gen-doc /usr/local/bin | ||
COPY script/entrypoint.sh ./ | ||
|
||
VOLUME ["/out", "/protos"] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.