Skip to content

Commit 81f44b7

Browse files
committed
multi: add Docker release helper
1 parent d0d8f2a commit 81f44b7

File tree

4 files changed

+55
-2
lines changed

4 files changed

+55
-2
lines changed

Makefile

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,22 @@ app-build: yarn-install
159159
@$(call print, "Building production app.")
160160
cd app; yarn build
161161

162-
release: app-build
162+
release: app-build go-release
163+
164+
go-release:
163165
@$(call print, "Creating release of lightning-terminal.")
164166
./release.sh build-release "$(VERSION_TAG)" "$(BUILD_SYSTEM)" "$(LND_RELEASE_TAGS)" "$(RELEASE_LDFLAGS)"
165167

168+
docker-release: app-build
169+
@$(call print, "Building release helper docker image.")
170+
if [ "$(tag)" = "" ]; then echo "Must specify tag=<commit_or_tag>!"; exit 1; fi
171+
172+
docker build -t litd-release-helper -f make/builder.Dockerfile make/
173+
174+
# Run the actual compilation inside the docker image. We pass in all flags
175+
# that we might want to overwrite in manual tests.
176+
$(DOCKER_RELEASE_HELPER) make go-release tag="$(tag)" sys="$(sys)" COMMIT="$(COMMIT)"
177+
166178
docker-tools:
167179
@$(call print, "Building tools docker image.")
168180
docker build -q -t litd-tools $(TOOLS_DIR)

make/builder.Dockerfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
FROM golang:1.22.6-bookworm
2+
3+
MAINTAINER Olaoluwa Osuntokun <laolu@lightning.engineering>
4+
5+
# Golang build related environment variables that are static and used for all
6+
# architectures/OSes.
7+
ENV GODEBUG netdns=cgo
8+
ENV GO111MODULE=auto
9+
ENV CGO_ENABLED=0
10+
11+
# Set up cache directories. Those will be mounted from the host system to speed
12+
# up builds. If go isn't installed on the host system, those will fall back to
13+
# temp directories during the build (see make/release_flags.mk).
14+
ENV GOCACHE=/tmp/build/.cache
15+
ENV GOMODCACHE=/tmp/build/.modcache
16+
17+
RUN apt-get update && apt-get install -y \
18+
git \
19+
make \
20+
tar \
21+
zip \
22+
bash \
23+
&& mkdir -p /tmp/build/litd \
24+
&& mkdir -p /tmp/build/.cache \
25+
&& mkdir -p /tmp/build/.modcache \
26+
&& chmod -R 777 /tmp/build/
27+
28+
WORKDIR /tmp/build/litd

make/release_flags.mk

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22
VERSION_TAG = $(shell git describe --abbrev=40 --broken --tags --always)
33
VERSION_CHECK = @$(call print, "Building master with date version tag")
44

5+
DOCKER_RELEASE_HELPER = docker run \
6+
-it \
7+
--rm \
8+
--user $(shell id -u):$(shell id -g) \
9+
-v $(shell pwd):/tmp/build/litd \
10+
-v $(shell bash -c "go env GOCACHE || (mkdir -p /tmp/go-cache; echo /tmp/go-cache)"):/tmp/build/.cache \
11+
-v $(shell bash -c "go env GOMODCACHE || (mkdir -p /tmp/go-modcache; echo /tmp/go-modcache)"):/tmp/build/.modcache \
12+
-e SKIP_VERSION_CHECK \
13+
litd-release-helper
14+
515
BUILD_SYSTEM = darwin-amd64 \
616
darwin-arm64 \
717
linux-386 \

release.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
# Simple bash script to build basic lnd tools for all the platforms
3+
# Simple bash script to build basic litd tools for all the platforms
44
# we support with the golang cross-compiler.
55
#
66
# Copyright (c) 2016 Company 0, LLC.
@@ -114,6 +114,9 @@ function build_release() {
114114
reproducible_tar_gzip ${package_source}
115115
mv "${package_source}.tar.gz" "${package_source}-$tag.tar.gz"
116116

117+
echo "Current git status before starting build: "
118+
git status
119+
117120
for i in $sys; do
118121
os=$(echo $i | cut -f1 -d-)
119122
arch=$(echo $i | cut -f2 -d-)

0 commit comments

Comments
 (0)