Skip to content

Commit 5590a58

Browse files
authored
devcontainer and release fixes (estuary#704)
1 parent fcffc08 commit 5590a58

File tree

2 files changed

+159
-67
lines changed

2 files changed

+159
-67
lines changed

.devcontainer/github-ubuntu-2004.Dockerfile

Lines changed: 153 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -14,48 +14,51 @@ ARG LOCALE=en_US.UTF-8
1414
# See the package list in the GitHub reference link above, at the very bottom,
1515
# which lists installed apt packages.
1616
RUN apt update -y \
17-
&& apt upgrade -y \
18-
&& DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends -y \
19-
bash-completion \
20-
build-essential \
21-
ca-certificates \
22-
clang-12 \
23-
cmake \
24-
curl \
25-
docker-compose \
26-
docker.io \
27-
git \
28-
gnupg2 \
29-
iproute2 \
30-
jq \
31-
less \
32-
libclang-12-dev \
33-
libsqlite3-dev \
34-
libssl-dev \
35-
lld-12 \
36-
locales \
37-
musl-tools \
38-
net-tools \
39-
netcat \
40-
openssh-client \
41-
pkg-config \
42-
postgresql-client \
43-
psmisc \
44-
sqlite3 \
45-
strace \
46-
sudo \
47-
tcpdump \
48-
unzip \
49-
vim-tiny \
50-
wget \
51-
zip
17+
&& apt upgrade -y \
18+
&& DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends -y \
19+
bash-completion \
20+
build-essential \
21+
ca-certificates \
22+
clang-12 \
23+
cmake \
24+
curl \
25+
docker-compose \
26+
docker.io \
27+
git \
28+
gnupg2 \
29+
iproute2 \
30+
jq \
31+
less \
32+
libclang-12-dev \
33+
libsqlite3-dev \
34+
libssl-dev \
35+
lld-12 \
36+
locales \
37+
musl-tools \
38+
net-tools \
39+
netcat \
40+
openssh-client \
41+
pkg-config \
42+
postgresql-client \
43+
psmisc \
44+
sqlite3 \
45+
strace \
46+
sudo \
47+
tcpdump \
48+
unzip \
49+
vim-tiny \
50+
wget \
51+
zip
5252

5353
RUN locale-gen ${LOCALE}
5454

5555
# Install git-lfs.
56-
RUN wget https://packagecloud.io/github/git-lfs/packages/debian/bullseye/git-lfs_3.2.0_amd64.deb/download \
57-
&& dpkg --install download \
58-
&& rm download
56+
# RUN wget https://packagecloud.io/github/git-lfs/packages/debian/bullseye/git-lfs_3.2.0_amd64.deb/download \
57+
# && dpkg --install download \
58+
# && rm download
59+
RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash \
60+
&& apt install -y git-lfs \
61+
&& git lfs install
5962

6063
# Install package sources for google-cloud-sdk repository.
6164
# Run `gcloud auth application-default login` to enable key management with the `sops` tool.
@@ -64,33 +67,33 @@ RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.
6467

6568
# Install package source for more recent Nodejs packages.
6669
RUN echo "Add NodeSource keyring for more recent nodejs packages" \
67-
&& export NODE_KEYRING=/usr/share/keyrings/nodesource.gpg \
68-
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | tee "$NODE_KEYRING" >/dev/null \
69-
&& gpg --no-default-keyring --keyring "$NODE_KEYRING" --list-keys \
70-
&& echo "deb [signed-by=$NODE_KEYRING] https://deb.nodesource.com/node_14.x bullseye main" | tee /etc/apt/sources.list.d/nodesource.list
70+
&& export NODE_KEYRING=/usr/share/keyrings/nodesource.gpg \
71+
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | tee "$NODE_KEYRING" >/dev/null \
72+
&& gpg --no-default-keyring --keyring "$NODE_KEYRING" --list-keys \
73+
&& echo "deb [signed-by=$NODE_KEYRING] https://deb.nodesource.com/node_14.x bullseye main" | tee /etc/apt/sources.list.d/nodesource.list
7174

7275
# Install google-cloud-sdk and nodejs.
7376
RUN apt update -y \
7477
&& apt install google-cloud-sdk nodejs --no-install-recommends -y \
7578
&& apt auto-remove -y
7679

7780
## Install Rust. This is pasted from:
78-
## https://github.com/rust-lang/docker-rust/blob/master/1.57.0/bullseye/Dockerfile
81+
## https://github.com/rust-lang/docker-rust/blob/master/1.64.0/bullseye/Dockerfile
7982
ENV RUSTUP_HOME=/usr/local/rustup \
8083
CARGO_HOME=/usr/local/cargo \
8184
PATH=/usr/local/cargo/bin:$PATH \
82-
RUST_VERSION=1.61.0
85+
RUST_VERSION=1.64.0
8386

8487
RUN set -eux; \
8588
dpkgArch="$(dpkg --print-architecture)"; \
8689
case "${dpkgArch##*-}" in \
87-
amd64) rustArch='x86_64-unknown-linux-gnu'; rustupSha256='3dc5ef50861ee18657f9db2eeb7392f9c2a6c95c90ab41e45ab4ca71476b4338' ;; \
88-
armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='67777ac3bc17277102f2ed73fd5f14c51f4ca5963adadf7f174adf4ebc38747b' ;; \
89-
arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='32a1532f7cef072a667bac53f1a5542c99666c4071af0c9549795bbdb2069ec1' ;; \
90-
i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='e50d1deb99048bc5782a0200aa33e4eea70747d49dffdc9d06812fd22a372515' ;; \
91-
*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \
90+
amd64) rustArch='x86_64-unknown-linux-gnu'; rustupSha256='5cc9ffd1026e82e7fb2eec2121ad71f4b0f044e88bca39207b3f6b769aaa799c' ;; \
91+
armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='48c5ecfd1409da93164af20cf4ac2c6f00688b15eb6ba65047f654060c844d85' ;; \
92+
arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='e189948e396d47254103a49c987e7fb0e5dd8e34b200aa4481ecc4b8e41fb929' ;; \
93+
i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='0e0be29c560ad958ba52fcf06b3ea04435cb3cd674fbe11ce7d954093b9504fd' ;; \
94+
*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \
9295
esac; \
93-
url="https://static.rust-lang.org/rustup/archive/1.24.3/${rustArch}/rustup-init"; \
96+
url="https://static.rust-lang.org/rustup/archive/1.25.1/${rustArch}/rustup-init"; \
9497
wget "$url"; \
9598
echo "${rustupSha256} *rustup-init" | sha256sum -c -; \
9699
chmod +x rustup-init; \
@@ -105,22 +108,109 @@ RUN set -eux; \
105108
# feature additional tools.
106109
# See: https://blog.rust-lang.org/2019/10/15/Rustup-1.20.0.html#profiles
107110
RUN rustup set profile default \
108-
&& rustup component add clippy rustfmt rust-docs
111+
&& rustup component add clippy rustfmt rust-docs
109112

110113
## Install Go.
111-
## See releases and SHAs at: https://go.dev/dl/
112-
ARG GOLANG_VERSION=1.18.3
113-
ARG GOLANG_SHA256=956f8507b302ab0bb747613695cdae10af99bbd39a90cae522b7c0302cc27245
114+
## From https://github.com/docker-library/golang/blob/master/1.19/bullseye/Dockerfile
115+
ARG GOLANG_VERSION=1.19.1
114116
ENV PATH=/usr/local/go/bin:$PATH
115117

116-
RUN curl -L -o /tmp/golang.tgz \
117-
https://golang.org/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz \
118-
&& echo "${GOLANG_SHA256} /tmp/golang.tgz" | sha256sum -c - \
119-
&& tar --extract \
120-
--file /tmp/golang.tgz \
121-
--directory /usr/local \
122-
&& rm /tmp/golang.tgz \
123-
&& go version
118+
RUN set -eux; \
119+
arch="$(dpkg --print-architecture)"; arch="${arch##*-}"; \
120+
url=; \
121+
case "$arch" in \
122+
'amd64') \
123+
url='https://dl.google.com/go/go1.19.1.linux-amd64.tar.gz'; \
124+
sha256='acc512fbab4f716a8f97a8b3fbaa9ddd39606a28be6c2515ef7c6c6311acffde'; \
125+
;; \
126+
'armel') \
127+
export GOARCH='arm' GOARM='5' GOOS='linux'; \
128+
;; \
129+
'armhf') \
130+
url='https://dl.google.com/go/go1.19.1.linux-armv6l.tar.gz'; \
131+
sha256='efe93f5671621ee84ce5e262e1e21acbc72acefbaba360f21778abd083d4ad16'; \
132+
;; \
133+
'arm64') \
134+
url='https://dl.google.com/go/go1.19.1.linux-arm64.tar.gz'; \
135+
sha256='49960821948b9c6b14041430890eccee58c76b52e2dbaafce971c3c38d43df9f'; \
136+
;; \
137+
'i386') \
138+
url='https://dl.google.com/go/go1.19.1.linux-386.tar.gz'; \
139+
sha256='9acc57342400c5b0c2da07b5b01b50da239dd4a7fad41a1fb56af8363ef4133f'; \
140+
;; \
141+
'mips64el') \
142+
export GOARCH='mips64le' GOOS='linux'; \
143+
;; \
144+
'ppc64el') \
145+
url='https://dl.google.com/go/go1.19.1.linux-ppc64le.tar.gz'; \
146+
sha256='4137984aa353de9c5ec1bd8fb3cd00a0624b75eafa3d4ec13d2f3f48261dba2e'; \
147+
;; \
148+
's390x') \
149+
url='https://dl.google.com/go/go1.19.1.linux-s390x.tar.gz'; \
150+
sha256='ca1005cc80a3dd726536b4c6ea5fef0318939351ff273eff420bd66a377c74eb'; \
151+
;; \
152+
*) echo >&2 "error: unsupported architecture '$arch' (likely packaging update needed)"; exit 1 ;; \
153+
esac; \
154+
build=; \
155+
if [ -z "$url" ]; then \
156+
# https://github.com/golang/go/issues/38536#issuecomment-616897960
157+
build=1; \
158+
url='https://dl.google.com/go/go1.19.1.src.tar.gz'; \
159+
sha256='27871baa490f3401414ad793fba49086f6c855b1c584385ed7771e1204c7e179'; \
160+
echo >&2; \
161+
echo >&2 "warning: current architecture ($arch) does not have a compatible Go binary release; will be building from source"; \
162+
echo >&2; \
163+
fi; \
164+
\
165+
wget -O go.tgz.asc "$url.asc"; \
166+
wget -O go.tgz "$url" --progress=dot:giga; \
167+
echo "$sha256 *go.tgz" | sha256sum -c -; \
168+
\
169+
# https://github.com/golang/go/issues/14739#issuecomment-324767697
170+
GNUPGHOME="$(mktemp -d)"; export GNUPGHOME; \
171+
# https://www.google.com/linuxrepositories/
172+
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 'EB4C 1BFD 4F04 2F6D DDCC EC91 7721 F63B D38B 4796'; \
173+
# let's also fetch the specific subkey of that key explicitly that we expect "go.tgz.asc" to be signed by, just to make sure we definitely have it
174+
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys '2F52 8D36 D67B 69ED F998 D857 78BD 6547 3CB3 BD13'; \
175+
gpg --batch --verify go.tgz.asc go.tgz; \
176+
gpgconf --kill all; \
177+
rm -rf "$GNUPGHOME" go.tgz.asc; \
178+
\
179+
tar -C /usr/local -xzf go.tgz; \
180+
rm go.tgz; \
181+
\
182+
if [ -n "$build" ]; then \
183+
savedAptMark="$(apt-mark showmanual)"; \
184+
apt-get update; \
185+
apt-get install -y --no-install-recommends golang-go; \
186+
\
187+
export GOCACHE='/tmp/gocache'; \
188+
\
189+
( \
190+
cd /usr/local/go/src; \
191+
# set GOROOT_BOOTSTRAP + GOHOST* such that we can build Go successfully
192+
export GOROOT_BOOTSTRAP="$(go env GOROOT)" GOHOSTOS="$GOOS" GOHOSTARCH="$GOARCH"; \
193+
./make.bash; \
194+
); \
195+
\
196+
apt-mark auto '.*' > /dev/null; \
197+
apt-mark manual $savedAptMark > /dev/null; \
198+
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
199+
rm -rf /var/lib/apt/lists/*; \
200+
\
201+
# remove a few intermediate / bootstrapping files the official binary release tarballs do not contain
202+
rm -rf \
203+
/usr/local/go/pkg/*/cmd \
204+
/usr/local/go/pkg/bootstrap \
205+
/usr/local/go/pkg/obj \
206+
/usr/local/go/pkg/tool/*/api \
207+
/usr/local/go/pkg/tool/*/go_bootstrap \
208+
/usr/local/go/src/cmd/dist/dist \
209+
"$GOCACHE" \
210+
; \
211+
fi; \
212+
\
213+
go version
124214

125215
# Add `flow` user with sudo access.
126216
RUN useradd flow --create-home --shell /bin/bash \
@@ -136,4 +226,4 @@ RUN bash /tmp/docker-debian.sh true /var/run/docker-host.sock /var/run/docker.so
136226
# the Docker socket if "overrideCommand": false is set in devcontainer.json.
137227
# The script will also execute CMD if you need to alter startup behaviors.
138228
ENTRYPOINT [ "/usr/local/share/docker-init.sh" ]
139-
CMD [ "sleep", "infinity" ]
229+
CMD [ "sleep", "infinity" ]

.devcontainer/release.Dockerfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,24 @@ RUN apt update -y \
88
ca-certificates \
99
curl \
1010
gpg \
11+
lsb-release \
1112
&& echo "Add NodeSource keyring for more recent nodejs packages" \
1213
&& export NODE_KEYRING=/usr/share/keyrings/nodesource.gpg \
1314
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | tee "$NODE_KEYRING" >/dev/null \
1415
&& gpg --no-default-keyring --keyring "$NODE_KEYRING" --list-keys \
1516
&& echo "deb [signed-by=$NODE_KEYRING] https://deb.nodesource.com/node_14.x bullseye main" | tee /etc/apt/sources.list.d/nodesource.list \
17+
&& mkdir -p /etc/apt/keyrings \
18+
&& curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg \
19+
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
20+
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null \
1621
&& apt update -y \
1722
&& apt upgrade -y \
1823
&& apt install --no-install-recommends -y \
1924
jq \
2025
nodejs \
26+
docker-ce-cli \
2127
&& rm -rf /var/lib/apt/lists/*
2228

23-
RUN curl -o docker-cli.deb 'https://download.docker.com/linux/debian/dists/bullseye/pool/stable/amd64/docker-ce-cli_20.10.7~3-0~debian-bullseye_amd64.deb' && \
24-
dpkg -i docker-cli.deb && \
25-
rm docker-cli.deb
26-
2729
# Create a non-privileged "flow" user.
2830
RUN useradd flow --create-home --shell /usr/sbin/nologin
2931

0 commit comments

Comments
 (0)