2525# Prefer binary installs over compilation where possible.
2626# We also heavily rely on staged builds to increase concurrency.
2727
28-
29-
3028# --------------------------------------------------
3129# STAGE: python-builder
3230# --------------------------------------------------
3533# files and installs them in a `venv`.
3634#
3735# Later, we'll copy this venv to our project
38- FROM ubuntu:20 .04 as python-builder
36+ FROM ubuntu:22 .04 AS python-builder
3937RUN apt update && apt install -qqy curl python3 python3-pip python3-venv libpq-dev
4038
4139# Create a python-venv that will include all dependencies
@@ -50,7 +48,6 @@ RUN curl -sSL https://install.python-poetry.org | python3 -
5048ENV PATH=$POETRY_HOME/bin:$PATH
5149RUN poetry self add poetry-plugin-export
5250
53-
5451# The pyproject.toml files describe our project
5552# I purposefully ignore lock-files here
5653# We are developping a libraries and if a new version of a
@@ -60,7 +57,7 @@ ADD libs/gl-client-py/pyproject.toml /repo/libs/gl-client-py/pyproject.toml
6057ADD libs/gl-testing/pyproject.toml /repo/libs/gl-testing/pyproject.toml
6158ADD libs/cln-version-manager/pyproject.toml /repo/libs/cln-version-manager/pyproject.toml
6259
63- WORKDIR repo
60+ WORKDIR / repo
6461
6562# We don't want to reinstall depenendencies every time
6663# a single line of library code changes.
@@ -84,7 +81,7 @@ RUN chmod a+rwx -R /tmp/venv
8481# STAGE: rust-builder
8582# --------------------------------------------
8683# Installs rustc and cargo using rust-up
87- from ubuntu:20 .04 as rust-base
84+ FROM ubuntu:22 .04 AS rust-base
8885RUN apt update && apt install curl build-essential -qqy
8986
9087ENV RUSTUP_HOME=/opt/rustup
@@ -104,13 +101,12 @@ RUN rustup default stable
104101# Ensure we can use cargo under a different user
105102RUN chmod a+rwx -R $CARGO_HOME
106103
107-
108104# ------------------------------------------
109105# STAGE: cln-downloader
110106# -----------------------------------------
111107# gl-testing requires multiple versions of Core Lightning
112108# Download all versions so they can be copied to our dev-container
113- FROM python-builder as cln-downloader
109+ FROM python-builder AS cln-downloader
114110
115111ARG GL_TESTING_IGNORE_HASH=0
116112
@@ -126,7 +122,7 @@ RUN GL_TESTING_IGNORE_HASH=${GL_TESTING_IGNORE_HASH} python -m clnvm get-all
126122# STAGE: bitcoin-downloader
127123# ------------------------------------
128124# Downloads bitcoin-core
129- FROM ubuntu:20 .04 as bitcoin-downloader
125+ FROM ubuntu:22 .04 AS bitcoin-downloader
130126RUN apt update && apt install -qqy wget
131127
132128ARG BITCOIN_VERSION=25.0
@@ -141,7 +137,7 @@ RUN cd /tmp/ && \
141137# STAGE: cfssl-downloader
142138# --------------------------------------
143139# Downloads cloudlfares SSL binaries
144- FROM ubuntu:20 .04 as cfssl-downloader
140+ FROM ubuntu:22 .04 AS cfssl-downloader
145141
146142RUN apt update && apt install -qqy wget
147143
@@ -153,7 +149,7 @@ RUN wget -q https://github.com/cloudflare/cfssl/releases/download/v1.5.0/cfssljs
153149# ----------------------------------------
154150# STAGE: protoc-downloader
155151# ----------------------------------------
156- from ubuntu:20 .04 as protoc-downloader
152+ FROM ubuntu:22 .04 AS protoc-downloader
157153RUN apt update && apt install -qqy wget unzip
158154RUN mkdir /tmp/protoc && \
159155 cd /tmp/protoc && \
@@ -168,7 +164,7 @@ RUN mkdir /tmp/protoc && \
168164# ---------------------------------------
169165# Create a release installation or all plugins.
170166# This is mainly useful for users who don't to build or edit the rust-code
171- FROM rust-base as gl-plugin-builder
167+ FROM rust-base AS gl-plugin-builder
172168
173169RUN apt update && apt install -qqy git
174170
@@ -178,19 +174,17 @@ COPY --from=protoc-downloader /usr/local/bin/protoc /usr/local/bin/protoc
178174# We should only ADD the files we need to optimize caching
179175ADD . /repo
180176
181-
182177WORKDIR /repo
183178
184179RUN cd /repo/libs/gl-plugin && cargo build && \
185180 cd /repo/libs/gl-signerproxy && cargo build
186181
187-
188182# ---------------------
189183# STAGE: Dev container
190184# ----------------------------
191185#
192186# This is the dev-container that we will be using
193- FROM rust-base as gl-dev
187+ FROM rust-base AS gl-dev
194188ENV DEBIAN_FRONTEND=noninteractive
195189# Indicate we run inside the Dockerfile
196190ENV GL_DOCKER=1
@@ -204,7 +198,7 @@ RUN apt-get update && apt install -qqy \
204198 git \
205199 jq \
206200 libpq5 \
207- python \
201+ python3 \
208202 python3-venv \
209203 python3-pip \
210204 tree \
@@ -234,8 +228,8 @@ COPY --from=bitcoin-downloader /opt/bitcoin/bin /opt/bitcoin/bin
234228ENV PATH=/opt/bitcoin/bin:$PATH
235229
236230# Install cfssl
237- copy --from=cfssl-downloader /usr/bin/cfssl /usr/local/bin/cfssl
238- copy --from=cfssl-downloader /usr/bin/cfssljson /usr/local/bin/cfssljson
231+ COPY --from=cfssl-downloader /usr/bin/cfssl /usr/local/bin/cfssl
232+ COPY --from=cfssl-downloader /usr/bin/cfssljson /usr/local/bin/cfssljson
239233
240234# Install protoc
241235COPY --from=protoc-downloader /usr/local/bin/protoc /usr/local/bin/protoc
@@ -270,6 +264,3 @@ RUN chmod -R a+rw /tmp/venv
270264# Create a symlink to the latest cln-version and add it to the path
271265RUN ln -s $(clnvm latest --root-path) /opt/cln-latest
272266ENV PATH=/opt/cln-latest/usr/local/bin:$PATH
273-
274-
275-
0 commit comments