-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
83 additions
and
8 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
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,57 @@ | ||
name: "docker: build release containers for normal volume" | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
workflow_dispatch: {} | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build-default-release-container: | ||
runs-on: self-hosted | ||
|
||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v2 | ||
- | ||
name: Docker meta | ||
id: docker_meta | ||
uses: docker/metadata-action@69f6fc9d46f2f8bf0d5491e4aabe0bb8c6a4678a # v3 | ||
with: | ||
images: | | ||
kmlebedev/netcitybot | ||
tags: | | ||
type=ref,event=tag | ||
flavor: | | ||
latest=false | ||
labels: | | ||
org.opencontainers.image.title=netcitybot | ||
org.opencontainers.image.description=NetCityBot is a API client and telegram bot for "Network City. Education" written in Golang | ||
org.opencontainers.image.vendor=Konstantin Lebedev | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@8b122486cedac8393e77aa9734c3528886e4a1a8 # v1 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@dc7b9719a96d48369863986a06765841d7ea23f6 # v1 | ||
- | ||
name: Login to Docker Hub | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b # v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
- | ||
name: Build | ||
uses: docker/build-push-action@c84f38281176d4c9cdb1626ffafcd6b3911b5d94 # v2 | ||
with: | ||
context: ./docker | ||
push: ${{ github.event_name != 'pull_request' }} | ||
file: ./docker/Dockerfile.go_build | ||
platforms: linux/amd64, linux/arm64 | ||
tags: ${{ steps.docker_meta.outputs.tags }} | ||
labels: ${{ steps.docker_meta.outputs.labels }} |
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 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,13 +1,14 @@ | ||
FROM golang:1.19-alpine as builder | ||
ENV GOARCH=amd64 | ||
|
||
COPY ./ /go/src/github.com/kmlebedev/netcitybot/ | ||
WORKDIR /go/src/github.com/kmlebedev/netcitybot | ||
RUN apk add git | ||
RUN mkdir -p /go/src/github.com/kmlebedev/netcitybot && \ | ||
git clone --branch main https://github.com/kmlebedev/netcitybot /go/src/github.com/kmlebedev/netcitybot | ||
|
||
RUN go mod download && GOOS=linux CGO_ENABLED=0 go build -ldflags "-extldflags -static" | ||
RUN cd /go/src/github.com/kmlebedev/netcitybot && \ | ||
CGO_ENABLED=0 GODEBUG=http2client=0 go install -ldflags "-extldflags -static" | ||
|
||
FROM alpine AS final | ||
|
||
COPY ./netcitybot /usr/bin/ | ||
LABEL author="Konstantin Lebedev" | ||
COPY --from=builder /go/bin/netcitybot /usr/bin/ | ||
|
||
ENTRYPOINT ["/usr/bin/netcitybot"] |
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,13 @@ | ||
FROM golang:1.19-alpine as builder | ||
ENV GOARCH=amd64 | ||
|
||
COPY ./ /go/src/github.com/kmlebedev/netcitybot/ | ||
WORKDIR /go/src/github.com/kmlebedev/netcitybot | ||
|
||
RUN go mod download && GOOS=linux CGO_ENABLED=0 go build -ldflags "-extldflags -static" | ||
|
||
FROM alpine AS final | ||
|
||
COPY ./netcitybot /usr/bin/ | ||
|
||
ENTRYPOINT ["/usr/bin/netcitybot"] |