Skip to content

Commit

Permalink
chore(ci): add dae docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
y0ngb1n committed Jul 18, 2024
1 parent 21eee2c commit 40f7bee
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/dae-docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# https://docs.github.com/en/actions/publishing-packages/publishing-docker-images
# https://github.com/daeuniverse/dae/blob/main/.github/workflows/docker.yml

name: "Build dae Docker image"

on:
workflow_dispatch:
push:
branches:
- main
paths:
- "dae/docker"
- ".github/workflows/dae-docker-build.yml"

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker images to ghcr.io
uses: docker/build-push-action@v4
with:
context: dae
file: ./dae/docker/Dockerfile
builder: ${{ steps.buildx.outputs.name }}
platforms: linux/arm/v7,linux/arm64,linux/amd64,linux/386
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/dae:v0.6.0
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/dae:latest
cache-from: type=gha
cache-to: type=gha,mode=max
28 changes: 28 additions & 0 deletions dae/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# https://github.com/daeuniverse/dae/blob/main/Dockerfile
# https://github.com/tailscale/tailscale/blob/main/Dockerfile

FROM golang:1.22-bookworm AS build-env

WORKDIR /build/

RUN apt-get update \
&& apt-get install -y llvm-15 clang-15 git make
ENV CLANG=clang-15

RUN git clone -b 'v0.6.0' --single-branch --depth 1 --recurse-submodules https://github.com/daeuniverse/dae.git . \
&& go mod download \
&& make OUTPUT=dae GOFLAGS="-buildvcs=false" CC=clang CGO_ENABLED=0

FROM alpine:3.18

RUN mkdir -p /usr/local/share/dae/ /etc/dae/ \
&& wget -O /usr/local/share/dae/geoip.dat https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat \
&& wget -O /usr/local/share/dae/geosite.dat https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat \
#&& apk add --no-cache ca-certificates iptables iproute2 ip6tables \
&& command -v nft >/dev/null || apk add --no-cache nftables

COPY --from=build-env /build/dae /usr/local/bin
COPY --from=build-env /build/install/empty.dae /etc/dae/config.dae
RUN chmod 0600 /etc/dae/config.dae

ENTRYPOINT ["dae", "run", "-c", "/etc/dae/config.dae"]

0 comments on commit 40f7bee

Please sign in to comment.