Skip to content

Commit

Permalink
Update workflow and move everything into building with the dockerfile…
Browse files Browse the repository at this point in the history
… rather than the weirdness beforehand
  • Loading branch information
NHAS committed Sep 4, 2023
1 parent 3e04ece commit ba1f13e
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 41 deletions.
68 changes: 30 additions & 38 deletions .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,57 +2,49 @@ name: Go
on: ["push"]

jobs:
build-and-test:
runs-on: ubuntu-22.04
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Go
run: curl -L https://go.dev/dl/go1.21.0.linux-amd64.tar.gz -o go1.21.0.linux-amd64.tar.gz && sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.21.0.linux-amd64.tar.gz

- name: Install dependencies
run: sudo apt install -y make wget llvm clang gcc git npm gulp libbpf-dev libpam0g-dev

- name: Set asm version
run: sudo ln -s /usr/include/x86_64-linux-gnu/asm /usr/include/asm

- name: Build with make
run: sudo PATH=/usr/local/go/bin:$PATH make release
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'

- name: Test with the Go CLI
run: sudo /usr/local/go/bin/go test -v ./...
run: sudo go test -v ./...

- uses: actions/upload-artifact@v3
with:
name: wag_binary
path: wag
retention-days: 1
deploy:
runs-on: ubuntu-22.04
needs: build-and-test
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/main'

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/download-artifact@v3
with:
name: wag_binary
path: wag

- name: docker login
env:
DOCKER_ACCESS_TOKEN: ${{secrets.DOCKER_ACCESS_TOKEN}}
run: |
docker login -u wagvpn -p $DOCKER_ACCESS_TOKEN
- name: Build the Docker image
run: docker build . --file Dockerfile --tag wagvpn/wag:$(date +%s) --tag wagvpn/wag

- name: Docker Push
run: docker push wagvpn/wag
fetch-tags: true

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: 'arm64,arm'

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: wagvpn
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v3
with:
push: true
tags: wagvpn/wag:latest
20 changes: 17 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
FROM golang:1.21 AS builder

RUN apt update && \
apt install -y make gcc-multilib wget llvm clang gcc git npm gulp libbpf-dev libpam0g-dev


RUN ln -s /usr/include$(uname -m)-linux-gnu/asm /usr/include/asm


WORKDIR /app
COPY . .
RUN make release

FROM redhat/ubi9-minimal:latest

RUN microdnf update -y
RUN microdnf install -y iptables nc pam

RUN microdnf update -y && \
microdnf install -y iptables nc pam

WORKDIR /app/wag

COPY wag/wag /usr/bin/wag
COPY --from=builder /app/wag /usr/bin/wag
COPY docker_entrypoint.sh /
RUN chmod +x /docker_entrypoint.sh /usr/bin/wag

Expand Down

0 comments on commit ba1f13e

Please sign in to comment.