1
- FROM golang:1.15.5-alpine as builder
2
-
3
- # Force Go to use the cgo based DNS resolver. This is required to ensure DNS
4
- # queries required to connect to linked containers succeed.
5
- ENV GODEBUG netdns=cgo
1
+ # Start with a NodeJS base image that also contains yarn.
2
+ FROM node:12.17.0-alpine as nodejsbuilder
6
3
7
4
# Pass a tag, branch or a commit using build-arg. This allows a docker image to
8
5
# be built from a specified Git state. The default image will use the Git tip of
9
6
# master by default.
10
7
ARG checkout="master"
11
8
9
+ RUN apk add --no-cache --update alpine-sdk \
10
+ git \
11
+ && git clone https://github.com/lightninglabs/lightning-terminal /go/src/github.com/lightninglabs/lightning-terminal \
12
+ && cd /go/src/github.com/lightninglabs/lightning-terminal \
13
+ && git checkout $checkout \
14
+ && cd app \
15
+ && yarn install \
16
+ && yarn build
17
+
18
+ # The first stage is already done and all static assets should now be generated
19
+ # in the app/build sub directory.
20
+ FROM golang:1.15.5-alpine as golangbuilder
21
+
22
+ # Instead of checking out from git again, we just copy the whole working
23
+ # directory of the previous stage that includes the generated static assets.
24
+ COPY --from=nodejsbuilder /go/src/github.com/lightninglabs/lightning-terminal /go/src/github.com/lightninglabs/lightning-terminal
25
+
26
+ # Force Go to use the cgo based DNS resolver. This is required to ensure DNS
27
+ # queries required to connect to linked containers succeed.
28
+ ENV GODEBUG netdns=cgo
29
+
12
30
# Explicitly turn on the use of modules (until this becomes the default).
13
31
ENV GO111MODULE on
14
32
15
- ENV NODE_VERSION=v12.17.0
16
-
17
33
# Install dependencies and install/build lightning-terminal.
18
34
RUN apk add --no-cache --update alpine-sdk \
19
- git \
20
35
make \
21
- curl \
22
- bash \
23
- binutils \
24
- tar \
25
- && touch ~/.bashrc \
26
- && curl -sfSLO https://unofficial-builds.nodejs.org/download/release/${NODE_VERSION}/node-${NODE_VERSION}-linux-x64-musl.tar.xz \
27
- && tar -xf node-${NODE_VERSION}-linux-x64-musl.tar.xz -C /usr --strip 1 \
28
- && rm node-${NODE_VERSION}-linux-x64-musl.tar.xz \
29
- && curl -o- -L https://yarnpkg.com/install.sh | bash \
30
- && . ~/.bashrc \
31
- && git clone https://github.com/lightninglabs/lightning-terminal /go/src/github.com/lightninglabs/lightning-terminal \
32
- && cd /go/src/github.com/lightninglabs/lightning-terminal \
33
- && git checkout $checkout \
34
- && make install \
35
- && make go-install-cli
36
+ && cd /go/src/github.com/lightninglabs/lightning-terminal \
37
+ && make statik-only \
38
+ && make go-install \
39
+ && make go-install-cli
36
40
37
41
# Start a new, final image to reduce size.
38
42
FROM alpine as final
@@ -44,11 +48,11 @@ VOLUME /root/.lnd
44
48
EXPOSE 8443 10009 9735
45
49
46
50
# Copy the binaries and entrypoint from the builder image.
47
- COPY --from=builder /go/bin/litd /bin/
48
- COPY --from=builder /go/bin/lncli /bin/
49
- COPY --from=builder /go/bin/frcli /bin/
50
- COPY --from=builder /go/bin/loop /bin/
51
- COPY --from=builder /go/bin/pool /bin/
51
+ COPY --from=golangbuilder /go/bin/litd /bin/
52
+ COPY --from=golangbuilder /go/bin/lncli /bin/
53
+ COPY --from=golangbuilder /go/bin/frcli /bin/
54
+ COPY --from=golangbuilder /go/bin/loop /bin/
55
+ COPY --from=golangbuilder /go/bin/pool /bin/
52
56
53
57
# Add bash.
54
58
RUN apk add --no-cache \
0 commit comments