Skip to content

Commit febef4a

Browse files
committed
add dockerfile
1 parent 1dd650a commit febef4a

File tree

3 files changed

+68
-15
lines changed

3 files changed

+68
-15
lines changed

.github/workflows/build.yaml

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
11
name: Build
22
on:
33
push:
4-
tags:
5-
- '*'
4+
branches:
5+
- master
66
jobs:
7-
release:
7+
build:
88
runs-on: ubuntu-latest
9+
name: Build
910
steps:
1011
- uses: actions/checkout@v3
12+
- uses: google-github-actions/auth@v1
13+
id: auth
1114
with:
12-
fetch-depth: 0
13-
- uses: actions/setup-go@v4
15+
credentials_json: ${{ secrets.GOOGLE_CREDENTIALS }}
16+
token_format: access_token
17+
- uses: docker/login-action@v1
1418
with:
15-
go-version: "^1.20"
16-
- uses: goreleaser/goreleaser-action@v4
19+
registry: asia-southeast1-docker.pkg.dev
20+
username: oauth2accesstoken
21+
password: ${{ steps.auth.outputs.access_token }}
22+
- uses: docker/setup-buildx-action@v2
1723
with:
1824
version: latest
19-
args: release --clean
20-
env:
21-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22-
- uses: actions/upload-artifact@v3
25+
- uses: docker/build-push-action@v4
2326
with:
24-
name: deploys
25-
path: dist/*
26-
env:
27-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
provenance: false
28+
push: true
29+
tags: asia-southeast1-docker.pkg.dev/deploys-app/public/cli:${{ github.sha }}

.github/workflows/release.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Release
2+
on:
3+
push:
4+
tags:
5+
- '*'
6+
jobs:
7+
release:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v3
11+
with:
12+
fetch-depth: 0
13+
- uses: actions/setup-go@v4
14+
with:
15+
go-version: "^1.21"
16+
- uses: goreleaser/goreleaser-action@v4
17+
with:
18+
version: latest
19+
args: release --clean
20+
env:
21+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22+
- uses: actions/upload-artifact@v3
23+
with:
24+
name: deploys
25+
path: dist/*
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM golang:1.21.4
2+
3+
ENV CGO_ENABLED=0
4+
5+
WORKDIR /workspace
6+
7+
ADD go.mod go.sum ./
8+
RUN go mod download
9+
ADD . .
10+
RUN go build -o .build/deploys -ldflags "-w -s" .
11+
12+
FROM debian:11-slim
13+
14+
RUN apt-get update && apt-get install -y \
15+
ca-certificates \
16+
&& rm -rf /var/lib/apt/lists/*
17+
18+
ENV PATH "$PATH:/app"
19+
20+
WORKDIR /app
21+
22+
COPY --from=0 --link /workspace/.build/* ./
23+
ADD ./entrypoint.sh ./entrypoint.sh
24+
ENTRYPOINT ["entrypoint.sh"]

0 commit comments

Comments
 (0)