hubcio commented on code in PR #3656:
URL: https://github.com/apache/iggy/pull/3656#discussion_r3568481881


##########
.devcontainer/devcontainer.json:
##########
@@ -0,0 +1,66 @@
+{
+  "name": "Apache Iggy",
+  "hostRequirements": {
+    "cpus": 4,
+    "memory": "16gb",
+    "storage": "32gb"
+  },
+  "build": {
+    "dockerfile": "Dockerfile",
+    "context": "..",
+    "args": {
+      "RUST_VERSION": "1.96"

Review Comment:
   please check `scripts/ci/sync-rustc-version.sh`: it only scans `Dockerfile*` 
files, so on the next toolchain bump it will rewrite the `ARG RUST_VERSION` 
default in the dockerfile but not this override - the devcontainer would 
silently keep building the old base. the arg passes the same value as the 
dockerfile default.
   
   i think whole `build.args` block can just be dropped.



##########
.devcontainer/devcontainer.json:
##########
@@ -0,0 +1,66 @@
+{
+  "name": "Apache Iggy",
+  "hostRequirements": {
+    "cpus": 4,
+    "memory": "16gb",
+    "storage": "32gb"
+  },
+  "build": {
+    "dockerfile": "Dockerfile",
+    "context": "..",
+    "args": {
+      "RUST_VERSION": "1.96"
+    }
+  },
+  "features": {},

Review Comment:
   `cargo test -p integration` won't work inside the container - the 
testcontainers-based suites need a docker socket and there's no docker cli 
here. worth adding `ghcr.io/devcontainers/features/docker-outside-of-docker` 
here (which would also give the bundled `ms-azuretools.vscode-docker` extension 
something to talk to), or noting the limitation in the PR description.
   
   did you actually try to run some tests in this container, or is it purely 
for rust analyzer?
   
   i didn't work with devcontainers + vscode.



##########
.devcontainer/devcontainer.json:
##########
@@ -0,0 +1,66 @@
+{
+  "name": "Apache Iggy",
+  "hostRequirements": {
+    "cpus": 4,
+    "memory": "16gb",
+    "storage": "32gb"
+  },
+  "build": {
+    "dockerfile": "Dockerfile",
+    "context": "..",
+    "args": {
+      "RUST_VERSION": "1.96"
+    }
+  },
+  "features": {},
+  "remoteUser": "vscode",
+  "workspaceMount": 
"source=${localWorkspaceFolder},target=/workspaces/iggy,type=bind,consistency=cached",
+  "workspaceFolder": "/workspaces/iggy",
+  "runArgs": [
+    "--init",
+    "--security-opt", "seccomp=unconfined",
+    "--ulimit", "memlock=-1:-1",
+    "--cap-add=SYS_NICE"
+  ],
+  "mounts": [
+    "type=volume,source=iggy-cargo-registry,target=/usr/local/cargo/registry",
+    "type=volume,source=iggy-target,target=/workspaces/iggy/target"
+  ],
+  "containerEnv": {
+    "CARGO_BUILD_JOBS": "4",
+    "IGGY_HTTP_ADDRESS": "0.0.0.0:3000",
+    "IGGY_QUIC_ADDRESS": "0.0.0.0:8080",
+    "IGGY_TCP_ADDRESS": "0.0.0.0:8090",
+    "IGGY_WEBSOCKET_ADDRESS": "0.0.0.0:8092"
+  },
+  "forwardPorts": [3000, 3050, 8080, 8090, 8092],

Review Comment:
   port forwarding in vs code / codespaces tunnels TCP only, and QUIC is UDP - 
so 8080 won't actually be reachable from the host through the forward. fine to 
keep for container-internal use, but the "all transports" claim in the 
description doesn't hold for QUIC.



##########
.devcontainer/devcontainer.json:
##########
@@ -0,0 +1,66 @@
+{
+  "name": "Apache Iggy",
+  "hostRequirements": {
+    "cpus": 4,
+    "memory": "16gb",
+    "storage": "32gb"
+  },
+  "build": {
+    "dockerfile": "Dockerfile",
+    "context": "..",
+    "args": {
+      "RUST_VERSION": "1.96"
+    }
+  },
+  "features": {},
+  "remoteUser": "vscode",
+  "workspaceMount": 
"source=${localWorkspaceFolder},target=/workspaces/iggy,type=bind,consistency=cached",
+  "workspaceFolder": "/workspaces/iggy",
+  "runArgs": [
+    "--init",
+    "--security-opt", "seccomp=unconfined",
+    "--ulimit", "memlock=-1:-1",
+    "--cap-add=SYS_NICE"
+  ],
+  "mounts": [
+    "type=volume,source=iggy-cargo-registry,target=/usr/local/cargo/registry",
+    "type=volume,source=iggy-target,target=/workspaces/iggy/target"
+  ],
+  "containerEnv": {
+    "CARGO_BUILD_JOBS": "4",
+    "IGGY_HTTP_ADDRESS": "0.0.0.0:3000",
+    "IGGY_QUIC_ADDRESS": "0.0.0.0:8080",
+    "IGGY_TCP_ADDRESS": "0.0.0.0:8090",
+    "IGGY_WEBSOCKET_ADDRESS": "0.0.0.0:8092"
+  },
+  "forwardPorts": [3000, 3050, 8080, 8090, 8092],
+  "portsAttributes": {
+    "3000": { "label": "HTTP (REST)" },
+    "3050": { "label": "Web UI (vite dev)" },
+    "8080": { "label": "QUIC" },
+    "8090": { "label": "TCP (binary)" },
+    "8092": { "label": "WebSocket" }
+  },
+  "postCreateCommand": "sudo chown -R vscode:vscode target 
/usr/local/cargo/registry 2>/dev/null; rustup show && npm --prefix web ci",

Review Comment:
   `-R` re-walks the whole cargo registry volume on every container recreate; 
after the first create the volumes are only ever written as `vscode`, so a 
non-recursive chown of the two mount points is enough. the `2>/dev/null` also 
hides real chown failures - if it ever does fail, the follow-up cargo 
permission error is much harder to trace.



##########
.devcontainer/Dockerfile:
##########
@@ -0,0 +1,64 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Toolchain is pinned by rust-toolchain.toml (channel 1.96.0). The base
+# image ships rustup, so the pin auto-resolves on first cargo invocation.
+ARG RUST_VERSION=1.96
+FROM rust:${RUST_VERSION}-slim-trixie
+
+# Build + runtime dependencies mirror the production Dockerfile builder
+# stage (native TLS, hwloc topology, udev). git/curl/gnupg/sudo/pkg-config
+# round out the dev shell.
+RUN apt-get update && apt-get install -y --no-install-recommends \
+    build-essential \
+    ca-certificates \
+    curl \
+    git \
+    gnupg \
+    pkg-config \
+    libssl-dev \
+    libhwloc-dev \
+    libudev-dev \
+    liblzma5 \
+    sudo \
+    && rm -rf /var/lib/apt/lists/*
+
+# Pin Node.js to the major version CI uses to build the web UI
+# (.github/workflows/_build_rust_artifacts.yml). NodeSource ships nodejs
+# with a bundled npm, so Debian's unversioned packages are not used.
+ARG NODE_VERSION=22
+RUN curl -fsSL "https://deb.nodesource.com/setup_${NODE_VERSION}.x"; | bash - \
+    && apt-get install -y --no-install-recommends nodejs \
+    && rm -rf /var/lib/apt/lists/*
+
+# Pre-fetch the pinned toolchain components (rustfmt, clippy) so the first
+# in-container build does not stall resolving them. rust-src is added for
+# rust-analyzer sysroot / standard-library resolution.
+COPY rust-toolchain.toml /tmp/rust-toolchain.toml
+RUN cd /tmp && rustup show && rustup component add rust-src && rm 
rust-toolchain.toml

Review Comment:
   the `1.96` tag ships the newest patch as the default toolchain (currently 
1.96.1), and the pin then installs 1.96.0 next to it, so the image carries two 
full toolchains. unavoidable while the sync script normalizes dockerfiles to 
the short tag - just noting where the extra size comes from.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to