Skip to content

Commit 70f6e04

Browse files
committed
feat: add docker image
1 parent c8cedb2 commit 70f6e04

File tree

5 files changed

+76
-3
lines changed

5 files changed

+76
-3
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: release blazehttp docker image
2+
3+
permissions:
4+
contents: write
5+
6+
on:
7+
push:
8+
tags:
9+
- 'v*'
10+
11+
env:
12+
DOCKERHUB_REPO: chaitin/blazehttp
13+
14+
jobs:
15+
docker:
16+
runs-on: ubuntu-latest
17+
steps:
18+
-
19+
name: Checkout
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
-
24+
name: Set up QEMU
25+
uses: docker/setup-qemu-action@v3
26+
-
27+
name: Set up Docker Buildx
28+
uses: docker/setup-buildx-action@v3
29+
-
30+
name: Login to Docker Hub
31+
uses: docker/login-action@v3
32+
with:
33+
username: ${{ secrets.DOCKERHUB_USERNAME }}
34+
password: ${{ secrets.DOCKERHUB_TOKEN }}
35+
-
36+
name: Generate App Version
37+
run: echo APP_VERSION=`git describe --tags --always` >> $GITHUB_ENV
38+
-
39+
name: Build and push
40+
uses: docker/build-push-action@v5
41+
with:
42+
platforms: linux/amd64,linux/arm64
43+
push: true
44+
build-args: |
45+
APP_VERSION=${{ env.APP_VERSION }}
46+
tags: |
47+
${{ env.DOCKERHUB_REPO }}:latest
48+
${{ env.DOCKERHUB_REPO }}:${{ env.APP_VERSION }}
49+

.github/workflows/release-gui-macos.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: release blasehttp macos gui
1+
name: release blazehttp macos gui
22

33
permissions:
44
contents: write

.github/workflows/release-gui-windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: release blasehttp windows gui
1+
name: release blazehttp windows gui
22

33
permissions:
44
contents: write

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: release blasehttp cli
1+
name: release blazehttp cli
22

33
permissions:
44
contents: write

Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM --platform=$BUILDPLATFORM golang:1.22 as builder
2+
3+
WORKDIR /src
4+
ENV CGO_ENABLED=0
5+
6+
COPY go.* .
7+
8+
ARG TARGETOS TARGETARCH
9+
10+
RUN --mount=type=bind,target=. \
11+
GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o /build/blazehttp cmd/blazehttp/main.go
12+
13+
14+
FROM --platform=$BUILDPLATFORM alpine:latest as binary
15+
16+
RUN apk add tzdata && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
17+
&& echo "Asia/Shanghai" > /etc/timezone \
18+
&& apk del tzdata
19+
20+
WORKDIR /app
21+
22+
COPY --from=builder /build/blazehttp /app/blazehttp
23+
24+
CMD [ "/app/blazehttp" ]

0 commit comments

Comments
 (0)