fix: feat add docker images #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Dev | |
on: | |
push: | |
branches: | |
- dev | |
pull_request: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-$${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: self-hosted | |
container: | |
image: ghcr.io/socoldkiller/headscale-build:dev | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build frontend | |
run: | | |
git clone https://github.com/socoldkiller/headscale-ui.git | |
cd headscale-ui | |
git checkout dev | |
bun install | |
bun run build | |
cd .. | |
cp -r headscale-ui/build hscontrol | |
- name: Build binary | |
run: | | |
go build -ldflags="-s -w" -o headscale ./cmd/headscale | |
- name: build docker image | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
echo "FROM alpine:latest" > Dockerfile | |
echo "COPY headscale /usr/local/bin/headscale" >> Dockerfile | |
echo "ENTRYPOINT [\"headscale\", \"serve\"]" >> Dockerfile | |
docker build -t ghcr.io/${{ github.repository }}:dev . | |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
docker push ghcr.io/${{ github.repository }}:dev |