Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: image build
on:
push:
branches:
- master
- docker

env:
REGISTRY: ghcr.io

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v2

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

- name: Log in to the Container registry
uses: docker/login-action@6d4b68b490aef8836e8fb5e50ee7b3bdfa5894f0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@418e4b98bf2841bd337d0b24fe63cb36dc8afa55
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}

- name: Build and push Docker image
uses: docker/build-push-action@14487ce63c7a62a4a324b0bfb37086795e31c6c1
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
31 changes: 31 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM golang:1-alpine AS builder

WORKDIR /app

# Copy go mod files first for better caching
COPY go.mod go.sum ./
RUN go mod download

# Copy source code
COPY . .

# Build the application
RUN CGO_ENABLED=0 GOOS=linux go build -o lnproxy ./cmd/http-relay

# Create a minimal runtime image
FROM alpine:3

RUN apk --no-cache add ca-certificates tzdata && \
adduser -D -h /app lnproxy

WORKDIR /app
USER lnproxy

# Copy the binary from the builder stage
COPY --from=builder --chown=lnproxy:lnproxy /app/lnproxy /app/

# Expose the default port
EXPOSE 4747

# Set the entrypoint
ENTRYPOINT ["/app/lnproxy"]
19 changes: 19 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
services:
lnproxy-relay:
build:
context: .
dockerfile: Dockerfile
container_name: lnproxy-relay
restart: unless-stopped
ports:
- "4747:4747"
volumes:
- ./lnproxy.macaroon:/app/lnproxy.macaroon:ro
- ${LND_CERT_PATH:-~/.lnd/tls.cert}:/app/tls.cert:ro
environment:
- TZ=UTC
command: >
-lnd=${LND_HOST:-https://127.0.0.1:8080}
-lnd-cert=/app/tls.cert
-port=4747
/app/lnproxy.macaroon