multi: add release helper docker file

This commit is contained in:
Oliver Gugger 2021-01-08 10:40:17 +01:00
parent 2686391c31
commit 4c56f3cacb
No known key found for this signature in database
GPG Key ID: 8E4256593F177720
9 changed files with 86 additions and 2 deletions

@ -23,6 +23,7 @@ env:
# /.travis.yml
# /Dockerfile
# /dev.Dockerfile
# /make/builder.Dockerfile
# /.github/workflows/release.yml
GO_VERSION: 1.15.6

@ -14,6 +14,7 @@ env:
# /.travis.yml
# /Dockerfile
# /dev.Dockerfile
# /make/builder.Dockerfile
# /.github/workflows/main.yml
GO_VERSION: 1.15.6

@ -19,6 +19,7 @@ go:
# If you change this value, please change it in the following files as well:
# /Dockerfile
# /dev.Dockerfile
# /make/builder.Dockerfile
# /.github/workflows/main.yml
# /.github/workflows/release.yml
- "1.15.6"

@ -1,3 +1,9 @@
# If you change this value, please change it in the following files as well:
# /.travis.yml
# /dev.Dockerfile
# /make/builder.Dockerfile
# /.github/workflows/main.yml
# /.github/workflows/release.yml
FROM golang:1.15.6-alpine as builder
# Force Go to use the cgo based DNS resolver. This is required to ensure DNS

@ -156,6 +156,14 @@ release:
$(VERSION_CHECK)
./scripts/release.sh build-release "$(VERSION_TAG)" "$(BUILD_SYSTEM)" "$(RELEASE_TAGS)" "$(RELEASE_LDFLAGS)"
docker-release:
@$(call print, "Building release helper docker image.")
if [ "$(tag)" = "" ]; then echo "Must specify tag=<commit_or_tag>!"; exit 1; fi
docker build -t lnd-release-helper -f make/builder.Dockerfile make/
$(DOCKER_RELEASE_HELPER) scripts/release.sh check-tag "$(VERSION_TAG)"
$(DOCKER_RELEASE_HELPER) scripts/release.sh build-release "$(VERSION_TAG)" "$(BUILD_SYSTEM)" "$(RELEASE_TAGS)" "$(RELEASE_LDFLAGS)"
scratch: build

@ -1,3 +1,9 @@
# If you change this value, please change it in the following files as well:
# /.travis.yml
# /Dockerfile
# /make/builder.Dockerfile
# /.github/workflows/main.yml
# /.github/workflows/release.yml
FROM golang:1.15.6-alpine as builder
LABEL maintainer="Olaoluwa Osuntokun <laolu@lightning.engineering>"

@ -10,7 +10,23 @@ utilize a work around needed until `go1.13.2`.
## Building a New Release
### macOS/Linux/Windows (WSL)
### MacOS
The first requirement is to have [`docker`](https://www.docker.com/)
installed locally and running. The second requirement is to have `make`
installed. Everything else (including `golang`) is included in the release
helper image.
To build a release, run the following commands:
1. `git clone https://github.com/lightningnetwork/lnd.git`
2. `cd lnd`
3. `git checkout <TAG> # <TAG> is the name of the next release/tag`
4. `make docker-release tag=<TAG>`
Where `<TAG>` is the name of the next release of `lnd`.
### Linux/Windows (WSL)
No prior set up is needed on Linux or macOS is required in order to build the
release binaries. However, on Windows, the only way to build the release
@ -19,7 +35,8 @@ the release binaries following these steps:
1. `git clone https://github.com/lightningnetwork/lnd.git`
2. `cd lnd`
3. `make release tag=<TAG> # <TAG> is the name of the next release/tag`
3. `git checkout <TAG> # <TAG> is the name of the next release/tag`
4. `make release tag=<TAG>`
This will then create a directory of the form `lnd-<TAG>` containing archives
of the release binaries for each supported operating system and architecture,

34
make/builder.Dockerfile Normal file

@ -0,0 +1,34 @@
# If you change this value, please change it in the following files as well:
# /.travis.yml
# /Dockerfile
# /dev.Dockerfile
# /.github/workflows/main.yml
# /.github/workflows/release.yml
FROM golang:1.15.6-buster
MAINTAINER Olaoluwa Osuntokun <laolu@lightning.engineering>
# Golang build related environment variables that are static and used for all
# architectures/OSes.
ENV GODEBUG netdns=cgo
ENV GO111MODULE=auto
ENV CGO_ENABLED=0
# Set up cache directories. Those will be mounted from the host system to speed
# up builds. If go isn't installed on the host system, those will fall back to
# temp directories during the build (see make/release_flags.mk).
ENV GOCACHE=/tmp/build/.cache
ENV GOMODCACHE=/tmp/build/.modcache
RUN apt-get update && apt-get install -y \
git \
make \
tar \
zip \
bash \
&& mkdir -p /tmp/build/lnd \
&& mkdir -p /tmp/build/.cache \
&& mkdir -p /tmp/build/.modcache \
&& chmod -R 777 /tmp/build/
WORKDIR /tmp/build/lnd

@ -1,6 +1,16 @@
VERSION_TAG = $(shell date +%Y%m%d)-01
VERSION_CHECK = @$(call print, "Building master with date version tag")
DOCKER_RELEASE_HELPER = docker run \
-it \
--rm \
--user $(shell id -u):$(shell id -g) \
-v $(shell pwd):/tmp/build/lnd \
-v $(shell bash -c "go env GOCACHE || (mkdir -p /tmp/go-cache; echo /tmp/go-cache)"):/tmp/build/.cache \
-v $(shell bash -c "go env GOMODCACHE || (mkdir -p /tmp/go-modcache; echo /tmp/go-modcache)"):/tmp/build/.modcache \
-e SKIP_VERSION_CHECK \
lnd-release-helper
BUILD_SYSTEM = darwin-amd64 \
dragonfly-amd64 \
freebsd-386 \