Merge pull request #22 from Lokowitz/add-docker-image

added docker version of olm

Former-commit-id: 9aa4288bfe
This commit is contained in:
Owen Schwartz
2025-08-31 09:55:08 -07:00
committed by GitHub
5 changed files with 47 additions and 2 deletions

View File

@@ -14,6 +14,18 @@ jobs:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Extract tag name - name: Extract tag name
id: get-tag id: get-tag
run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
@@ -32,6 +44,10 @@ jobs:
else else
echo "main.go not found" echo "main.go not found"
fi fi
- name: Build and push Docker images
run: |
TAG=${{ env.TAG }}
make docker-build-release tag=$TAG
- name: Build binaries - name: Build binaries
run: | run: |

View File

@@ -21,5 +21,8 @@ jobs:
- name: Build go - name: Build go
run: go build run: go build
- name: Build Docker image
run: make build
- name: Build binaries - name: Build binaries
run: make go-build-release run: make go-build-release

View File

@@ -16,9 +16,9 @@ COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -o /olm RUN CGO_ENABLED=0 GOOS=linux go build -o /olm
# Start a new stage from scratch # Start a new stage from scratch
FROM ubuntu:24.04 AS runner FROM alpine:3.22 AS runner
RUN apt-get update && apt-get install ca-certificates -y && rm -rf /var/lib/apt/lists/* RUN apk --no-cache add ca-certificates
# Copy the pre-built binary file from the previous stage and the entrypoint script # Copy the pre-built binary file from the previous stage and the entrypoint script
COPY --from=builder /olm /usr/local/bin/ COPY --from=builder /olm /usr/local/bin/

View File

@@ -1,9 +1,20 @@
all: go-build-release all: go-build-release
docker-build-release:
@if [ -z "$(tag)" ]; then \
echo "Error: tag is required. Usage: make docker-build-release tag=<tag>"; \
exit 1; \
fi
docker buildx build --platform linux/arm/v7,linux/arm64,linux/amd64 -t fosrl/olm:latest -f Dockerfile --push .
docker buildx build --platform linux/arm/v7,linux/arm64,linux/amd64 -t fosrl/olm:$(tag) -f Dockerfile --push .
local: local:
CGO_ENABLED=0 go build -o olm CGO_ENABLED=0 go build -o olm
build:
docker build -t fosrl/olm:latest .
go-build-release: go-build-release:
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o bin/olm_linux_arm64 CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o bin/olm_linux_arm64
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o bin/olm_linux_amd64 CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o bin/olm_linux_amd64

15
docker-compose.yml Normal file
View File

@@ -0,0 +1,15 @@
services:
olm:
image: fosrl/olm:latest
container_name: olm
restart: unless-stopped
environment:
- PANGOLIN_ENDPOINT=https://example.com
- OLM_ID=vdqnz8rwgb95cnp
- OLM_SECRET=1sw05qv1tkfdb1k81zpw05nahnnjvmhxjvf746umwagddmdg
cap_add:
- NET_ADMIN
- SYS_MODULE
devices:
- /dev/net/tun:/dev/net/tun
network_mode: host