Skip to content

Commit

Permalink
Merge pull request #10 from muzzammilshahid/docker-packaging
Browse files Browse the repository at this point in the history
Docker packaging
  • Loading branch information
muzzammilshahid authored Oct 4, 2024
2 parents 08ba15c + 466d3ce commit b68798c
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ jobs:
exit 1;
fi
- name: Build docker
run: make build-docker

- name: Run unit tests
run: |
make test
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM golang:1.22 AS builder

RUN apt-get update && \
apt-get install -y \
iptables \
wireguard \
iproute2 \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /app

COPY . .

RUN make build-http && strip http-service

FROM ubuntu:22.04

WORKDIR /app

COPY --from=builder /usr/bin/wg-quick /usr/bin/
COPY --from=builder /usr/bin/wg /usr/bin/
COPY --from=builder /app/http-service /app/

CMD ["./http-service"]
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,9 @@ build-http:

run-http:
go run github.com/xconnio/wireguard-admin-service/cmd/http-service

build-docker:
docker build -t wireguard .

run-docker:
docker compose up
9 changes: 9 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: '3.8'

services:
wireguard:
image: wireguard
container_name: wireguard
network_mode: host
cap_add:
- NET_ADMIN

0 comments on commit b68798c

Please sign in to comment.