Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci中添加构建tun only的镜像 #51

Merged
merged 1 commit into from
Nov 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ permissions: write-all

jobs:
build:
strategy:
matrix:
build_tag: [ full, tun ]

runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -51,11 +55,26 @@ jobs:
type=raw,value=latest,enable=${{ github.event_name == 'release' }}

# https://github.com/docker/build-push-action
- name: Build and push
- name: Build and push full version
if: ${{ matrix.build_tag == 'full' }}
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
build_tag=${{ matrix.build_tag }}

- name: Bulid and push not full version
if: ${{ matrix.build_tag != 'full' }}
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}-${{ matrix.build_tag }}
labels: ${{ steps.meta.outputs.labels }}-${{ matrix.build_tag }}
build-args: |
build_tag=${{ matrix.build_tag }}
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ENV GO111MODULE=on
ENV CGO_ENABLED=0
ENV GOOS=linux
ENV GOARCH=amd64

ARG build_tag=full
RUN go env -w GOPROXY=https://goproxy.cn,direct

WORKDIR /src
Expand All @@ -21,7 +21,7 @@ RUN --mount=target=. \
--mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
# go build -ldflags="-w -s" -o /app/main ./cmd/openwrt-wan-reconnect/*.go
go build -v -o /app/zju-connect -trimpath -ldflags "-s -w -buildid=" .
go build -tags ${build_tag} -v -o /app/zju-connect -trimpath -ldflags "-s -w -buildid=" .

# Import the binary from build stage
FROM gcr.dockerproxy.com/distroless/static:nonroot as prd
Expand Down
Loading