From 2b095bbba3e0c5472041509a3b370aefe15109a0 Mon Sep 17 00:00:00 2001 From: Aaron Dewes Date: Wed, 27 Oct 2021 15:29:18 +0100 Subject: [PATCH 1/4] WIP: Docker container --- .github/workflows/on-push.yml | 43 +++++++++++++++++++++++++++++++++++ .github/workflows/on-tag.yml | 43 +++++++++++++++++++++++++++++++++++ Dockerfile | 18 +++++++++++++++ 3 files changed, 104 insertions(+) create mode 100644 .github/workflows/on-push.yml create mode 100644 .github/workflows/on-tag.yml create mode 100644 Dockerfile diff --git a/.github/workflows/on-push.yml b/.github/workflows/on-push.yml new file mode 100644 index 0000000..57903f1 --- /dev/null +++ b/.github/workflows/on-push.yml @@ -0,0 +1,43 @@ +name: Build on push + +permissions: + packages: write + +on: + push: + branches: + - main + - master + +jobs: + build: + name: Build image + runs-on: ubuntu-20.04 + + steps: + - name: Checkout project + uses: actions/checkout@v2 + + - name: Set env variables + run: | + echo "BRANCH=$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//-/g')" >> $GITHUB_ENV + IMAGE_NAME="${GITHUB_REPOSITORY#*/}" + echo "IMAGE_NAME=${IMAGE_NAME//docker-/}" >> $GITHUB_ENV + + - name: Login to Docker Hub + run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + id: qemu + + - name: Setup Docker buildx action + uses: docker/setup-buildx-action@v1 + id: buildx + + - name: Run Docker buildx + run: | + docker buildx build \ + --platform linux/amd64,linux/arm64 \ + --tag ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME:$BRANCH \ + --output "type=registry" ./ diff --git a/.github/workflows/on-tag.yml b/.github/workflows/on-tag.yml new file mode 100644 index 0000000..f35c595 --- /dev/null +++ b/.github/workflows/on-tag.yml @@ -0,0 +1,43 @@ +name: Build on tag + +permissions: + packages: write + +on: + push: + tags: + - v[0-9]+.[0-9]+.[0-9]+ + - v[0-9]+.[0-9]+.[0-9]+-* + +jobs: + build: + name: Build image + runs-on: ubuntu-20.04 + + steps: + - name: Checkout project + uses: actions/checkout@v2 + + - name: Set env variables + run: | + echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV + IMAGE_NAME="${GITHUB_REPOSITORY#*/}" + echo "IMAGE_NAME=${IMAGE_NAME//docker-/}" >> $GITHUB_ENV + + - name: Login to Docker Hub + run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + id: qemu + + - name: Setup Docker buildx action + uses: docker/setup-buildx-action@v1 + id: buildx + + - name: Run Docker buildx + run: | + docker buildx build \ + --platform linux/amd64,linux/arm64 \ + --tag ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME:$BRANCH \ + --output "type=registry" ./ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..800b2cb --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +# Go base image +FROM golang:1.17-alpine as builder + +RUN go get github.com/GeertJohan/go.rice && go get github.com/GeertJohan/go.rice/rice + +WORKDIR /app + +COPY . . + +RUN go install + +RUN rice embed-go && go build + +FROM golang:1.17-alpine + +COPY --from=builder /app/lnme /lnme + +CMD ["/lnme"] From e3bf2c0537faf57ce899189f8309c34b36fc35bd Mon Sep 17 00:00:00 2001 From: Aaron Dewes Date: Wed, 27 Oct 2021 15:57:55 +0100 Subject: [PATCH 2/4] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 800b2cb..a3b39b4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ RUN go install RUN rice embed-go && go build -FROM golang:1.17-alpine +FROM alpine:3.14 COPY --from=builder /app/lnme /lnme From 44befafc6d0b15c95c83ad901ab8eb84262ee7d3 Mon Sep 17 00:00:00 2001 From: Aaron Dewes Date: Wed, 27 Oct 2021 17:35:06 +0100 Subject: [PATCH 3/4] Add expose command with default port --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index a3b39b4..30c8644 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,4 +15,6 @@ FROM alpine:3.14 COPY --from=builder /app/lnme /lnme +EXPOSE 1323 + CMD ["/lnme"] From 51a8d1ca227e2ad5fadf87750660dc4cf3cf4fc9 Mon Sep 17 00:00:00 2001 From: Aaron Dewes Date: Sat, 6 Nov 2021 17:39:17 +0000 Subject: [PATCH 4/4] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 5acf4d1..cc49c4b 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,12 @@ There are no other dependencies. Simply download the binary and run it! Note: You must have [go.rice installed](https://github.com/GeertJohan/go.rice#installation) +### Running in Docker + +LnMe is now available in docker too. +You can start LnMe like this: `docker run -it --rm ghcr.io/bumi/lnme:master` +A list of existing tags is available [here](https://github.com/bumi/lnme/pkgs/container/lnme). + ### Configuration #### LND configuration