Skip to content

Commit b2f5c6b

Browse files
committed
.devcontainer: update ubuntu-2004 environment
1 parent 0e70903 commit b2f5c6b

File tree

3 files changed

+56
-204
lines changed

3 files changed

+56
-204
lines changed

.devcontainer/devcontainer.json

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
"dockerComposeFile": "docker-compose.yaml",
44
"service": "develop",
55
"workspaceFolder": "/workspace",
6-
// Set *default* container specific settings.json values on container create.
6+
// Set default container specific settings.json values on container create.
77
"settings": {
8-
"terminal.integrated.shell.linux": "/bin/bash",
8+
// Integrate the empty docker-compose database into VSCode.
99
"sqltools.connections": [
1010
{
1111
"name": "Container database",
@@ -18,6 +18,27 @@
1818
"password": "flow"
1919
}
2020
],
21+
// Add extra CGO configuration required for the vscode-go extension to build
22+
// the project through IDE-driven interactions, like running tests and analysis.
23+
// Yes, these `testEnvVars` vs `toolsEnvVars` blocks are identical.
24+
"go.testEnvVars": {
25+
"CGO_LDFLAGS": "-L /workspaces/flow/target/release -L /workspaces/flow/target/release/librocksdb-exp -lbindings -lrocksdb -lsnappy -lstdc++ -ldl -lm",
26+
"CGO_CFLAGS": "-I /workspaces/flow/target/release/librocksdb-exp/include",
27+
"CGO_CPPFLAGS": "-I /workspaces/flow/target/release/librocksdb-exp/include"
28+
},
29+
"go.toolsEnvVars": {
30+
"CGO_LDFLAGS": "-L /workspaces/flow/target/release -L /workspaces/flow/target/release/librocksdb-exp -lbindings -lrocksdb -lsnappy -lstdc++ -ldl -lm",
31+
"CGO_CFLAGS": "-I /workspaces/flow/target/release/librocksdb-exp/include",
32+
"CGO_CPPFLAGS": "-I /workspaces/flow/target/release/librocksdb-exp/include"
33+
},
34+
// Set a default terminal to use.
35+
"terminal.integrated.profiles.linux": {
36+
"bash": {
37+
"path": "bash",
38+
"icon": "terminal-bash"
39+
},
40+
},
41+
"terminal.integrated.defaultProfile.linux": "bash",
2142
},
2243
// Add the IDs of extensions you want installed when the container is created.
2344
"extensions": [
@@ -52,7 +73,7 @@
5273
// Run extra environment setup required to build & test Flow.
5374
// We're using a base image which is compatible with our CI runner,
5475
// and thus use the same make target.
55-
"postCreateCommand": "make extra-ci-runner-setup && make package",
76+
"postCreateCommand": "make extra-ci-runner-setup && go mod download && make package",
5677
// This user matches the user that's created inside the flow image
5778
"remoteUser": "flow",
5879
"overrideCommand": false

.devcontainer/github-ubuntu-1804.Dockerfile

Lines changed: 0 additions & 175 deletions
This file was deleted.

.devcontainer/github-ubuntu-2004.Dockerfile

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,30 @@
44
#
55
# Don't install anything in this Dockerfile which isn't also present in that environment!
66
# Instead, further packages must be installed through explicit build steps.
7-
# This practice keeps builds within docker environments (i.e. codespaces) in lock-step
8-
# with what GitHub Actions CI produces.
7+
# This practice keeps builds within devcontainer environments (i.e. codespaces) in lock-step
8+
# with what works in GitHub Actions CI.
99
FROM ubuntu:20.04
1010

1111
## Set a configured locale.
1212
ARG LOCALE=en_US.UTF-8
1313

1414
# See the package list in the GitHub reference link above, at the very bottom,
1515
# which lists installed apt packages.
16-
RUN apt-get update -y \
17-
&& apt-get upgrade -y \
18-
&& DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
16+
RUN apt update -y \
17+
&& apt upgrade -y \
18+
&& DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends -y \
1919
bash-completion \
2020
build-essential \
2121
ca-certificates \
2222
clang-12 \
2323
curl \
24+
docker-compose \
25+
docker.io \
2426
git \
2527
gnupg2 \
2628
iproute2 \
2729
jq \
30+
less \
2831
libclang-12-dev \
2932
libncurses5-dev \
3033
libreadline-dev \
@@ -33,7 +36,6 @@ RUN apt-get update -y \
3336
locales \
3437
net-tools \
3538
netcat \
36-
nodejs \
3739
npm \
3840
openssh-client \
3941
pkg-config \
@@ -44,16 +46,31 @@ RUN apt-get update -y \
4446
sudo \
4547
tcpdump \
4648
unzip \
49+
vim-tiny \
4750
wget \
4851
zip
4952

50-
## Install Rust. This is pasted from:
51-
## https://github.com/rust-lang/docker-rust/blob/master/1.51.0/bullseye/Dockerfile
53+
# Install package sources for google-cloud-sdk repository.
54+
# Run `gcloud auth application-default login` to enable key management with the `sops` tool.
55+
RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list \
56+
&& curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
57+
# Install package source for more recent Nodejs packages.
58+
RUN echo "Add NodeSource keyring for more recent nodejs packages" \
59+
&& export NODE_KEYRING=/usr/share/keyrings/nodesource.gpg \
60+
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | tee "$NODE_KEYRING" >/dev/null \
61+
&& gpg --no-default-keyring --keyring "$NODE_KEYRING" --list-keys \
62+
&& echo "deb [signed-by=$NODE_KEYRING] https://deb.nodesource.com/node_14.x bullseye main" | tee /etc/apt/sources.list.d/nodesource.list
63+
# Install google-cloud-sdk and nodejs.
64+
RUN apt update -y \
65+
&& apt install google-cloud-sdk nodejs --no-install-recommends -y \
66+
&& apt auto-remove -y
5267

68+
## Install Rust. This is pasted from:
69+
## https://github.com/rust-lang/docker-rust/blob/master/1.57.0/bullseye/Dockerfile
5370
ENV RUSTUP_HOME=/usr/local/rustup \
5471
CARGO_HOME=/usr/local/cargo \
5572
PATH=/usr/local/cargo/bin:$PATH \
56-
RUST_VERSION=1.54.0
73+
RUST_VERSION=1.57.0
5774

5875
RUN set -eux; \
5976
dpkgArch="$(dpkg --print-architecture)"; \
@@ -82,9 +99,9 @@ RUN rustup set profile default \
8299
&& rustup component add clippy rustfmt rust-docs
83100

84101
## Install Go.
85-
## TODO(johnny): Downgrade from 1.16.7 => 1.16.6 (#191)
86-
ARG GOLANG_VERSION=1.16.6
87-
ARG GOLANG_SHA256=be333ef18b3016e9d7cb7b1ff1fdb0cac800ca0be4cf2290fe613b3d069dfe0d
102+
## See releases and SHAs at: https://go.dev/dl/
103+
ARG GOLANG_VERSION=1.17.5
104+
ARG GOLANG_SHA256=bd78114b0d441b029c8fe0341f4910370925a4d270a6a590668840675b0c653e
88105
ENV PATH=/usr/local/go/bin:$PATH
89106

90107
RUN curl -L -o /tmp/golang.tgz \
@@ -96,25 +113,14 @@ RUN curl -L -o /tmp/golang.tgz \
96113
&& rm /tmp/golang.tgz \
97114
&& go version
98115

99-
## Install Docker.
100-
ARG DOCKER_VERSION=19.03.13
101-
ARG DOCKER_SHA256=ddb13aff1fcdcceb710bf71a210169b9c1abfd7420eeaf42cf7975f8fae2fcc8
102-
103-
RUN curl -L -o /tmp/docker.tgz \
104-
https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKER_VERSION}.tgz \
105-
&& echo "${DOCKER_SHA256} /tmp/docker.tgz" | sha256sum -c - \
106-
&& tar --extract \
107-
--file /tmp/docker.tgz \
108-
--strip-components 1 \
109-
--directory /usr/local/bin/ \
110-
&& rm /tmp/docker.tgz \
111-
&& docker --version
112-
113116
RUN locale-gen ${LOCALE}
114117

118+
# Allow `flow` user to sudo within the container.
115119
RUN useradd flow --create-home --shell /usr/sbin/nologin \
116120
&& echo flow ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/flow \
117121
&& chmod 0440 /etc/sudoers.d/flow
122+
# Go binaries built by `flow` should be on the PATH.
123+
ENV PATH=/home/flow/go/bin:$PATH
118124

119125
# Adapted from: https://github.com/microsoft/vscode-dev-containers/tree/main/containers/docker-from-docker#adding-the-user-to-a-docker-group
120126
COPY docker-debian.sh /tmp

0 commit comments

Comments
 (0)