Skip to content

Commit fe028d9

Browse files
committed
debug: try build ignorance approach.
1 parent b8479e5 commit fe028d9

File tree

4 files changed

+66
-63
lines changed

4 files changed

+66
-63
lines changed

docker/build/movement/Dockerfile

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,14 @@
1-
FROM ubuntu:24.10 AS builder
1+
FROM nixos/nix:2.29.0 AS builder
22

3-
# Create non-root user early
4-
RUN useradd -ms /bin/bash builder
5-
6-
# Install curl and other deps as root BEFORE switching users
7-
RUN apt-get update && apt-get install -y curl systemd ca-certificates && rm -rf /var/lib/apt/lists/*
8-
9-
USER builder
10-
ENV USER=builder
11-
WORKDIR /home/builder
12-
13-
# Install Determinate Nix as builder (non-root setup)
14-
RUN curl --proto '=https' --tlsv1.2 -sSf https://install.determinate.systems/nix | \
15-
bash -s -- install linux \
16-
--extra-conf "sandbox = false" \
17-
--no-start-daemon \
18-
--no-confirm && exit 1
19-
# DEBUG: existing above to show output for nix path
20-
21-
# Set up proper Nix PATH for non-root user
22-
ENV PATH="${PATH}:/nix/var/nix/profiles/default/bin"
23-
24-
# Prove it works
25-
RUN nix run nixpkgs#hello
3+
RUN nix-env -iA nixpkgs.rsync nixpkgs.glibc nixpkgs.gawk
264

275
# Copy the source code into the container
286
COPY . /tmp/build
297
WORKDIR /tmp/build
308

9+
# Set build to docker to skip the podman initilization while opening the flake
10+
ENV BUILD=docker
11+
3112
# Build the Rust application
3213
RUN nix --extra-experimental-features "nix-command flakes" \
3314
develop .#docker-build --command bash -c "cargo build --release -p movement"
@@ -64,5 +45,22 @@ RUN chmod +x /app/entry.sh
6445
# Switch to non-root user
6546
USER movement
6647

48+
# Manually pull the needed images
49+
# TODO: this should be refactored s.t. we can get the list from the movement command. But, probably not in this PR.
50+
# "movement-full-node"
51+
RUN podman pull ghcr.io/movementlabsxyz/movement-full-node:c2372ff
52+
# "movement-celestia-da-light-node"
53+
RUN podman pull ghcr.io/movementlabsxyz/movement-celestia-da-light-node:c2372ff
54+
# "movement-full-node-setup"
55+
RUN podman pull ghcr.io/movementlabsxyz/movement-full-node-setup:c2372ff
56+
# "movement-faucet-service"
57+
RUN podman pull ghcr.io/movementlabsxyz/movement-faucet-service:c2372ff
58+
# "movement-celestia-bridge"
59+
RUN podman pull ghcr.io/movementlabsxyz/movement-celestia-bridge:c2372ff
60+
# "movement-celestia-appd"
61+
RUN podman pull ghcr.io/movementlabsxyz/movement-celestia-appd:c2372ff
62+
# "wait-for-celestia-light-node"
63+
RUN podman pull ghcr.io/movementlabsxyz/wait-for-celestia-light-node:c2372ff
64+
6765
# Entrypoint to bootstrap podman and launch movement
6866
ENTRYPOINT ["/app/entry.sh"]

docker/build/mtma/Dockerfile

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,14 @@
1-
FROM ubuntu:24.10 AS builder
1+
FROM nixos/nix:2.29.0 AS builder
22

3-
# Create non-root user early
4-
RUN useradd -ms /bin/bash builder
5-
6-
# Install curl and other deps as root BEFORE switching users
7-
RUN apt-get update && apt-get install -y curl systemd ca-certificates && rm -rf /var/lib/apt/lists/*
8-
9-
USER builder
10-
ENV USER=builder
11-
WORKDIR /home/builder
12-
13-
# Install Determinate Nix as builder (non-root setup)
14-
RUN curl --proto '=https' --tlsv1.2 -sSf https://install.determinate.systems/nix | \
15-
bash -s -- install linux \
16-
--extra-conf "sandbox = false" \
17-
--no-start-daemon \
18-
--no-confirm
19-
20-
# Set up proper Nix PATH for non-root user
21-
ENV PATH="${PATH}:/nix/var/nix/profiles/default/bin"
22-
23-
# Prove it works
24-
RUN nix run nixpkgs#hello
3+
RUN nix-env -iA nixpkgs.rsync nixpkgs.glibc nixpkgs.gawk
254

265
# Copy the source code into the container
276
COPY . /tmp/build
287
WORKDIR /tmp/build
298

9+
# Set build to docker to skip the podman initilization while opening the flake
10+
ENV BUILD=docker
11+
3012
# Build the Rust application
3113
RUN nix --extra-experimental-features "nix-command flakes" \
3214
develop .#docker-build --command bash -c "cargo build --release -p mtma"
@@ -62,5 +44,22 @@ RUN chmod +x /app/entry.sh
6244
# Switch to non-root user
6345
USER mtma
6446

47+
# Manually pull the needed images
48+
# TODO: this should be refactored s.t. we can get the list from the movement command. But, probably not in this PR.
49+
# "movement-full-node"
50+
RUN podman pull ghcr.io/movementlabsxyz/movement-full-node:c2372ff
51+
# "movement-celestia-da-light-node"
52+
RUN podman pull ghcr.io/movementlabsxyz/movement-celestia-da-light-node:c2372ff
53+
# "movement-full-node-setup"
54+
RUN podman pull ghcr.io/movementlabsxyz/movement-full-node-setup:c2372ff
55+
# "movement-faucet-service"
56+
RUN podman pull ghcr.io/movementlabsxyz/movement-faucet-service:c2372ff
57+
# "movement-celestia-bridge"
58+
RUN podman pull ghcr.io/movementlabsxyz/movement-celestia-bridge:c2372ff
59+
# "movement-celestia-appd"
60+
RUN podman pull ghcr.io/movementlabsxyz/movement-celestia-appd:c2372ff
61+
# "wait-for-celestia-light-node"
62+
RUN podman pull ghcr.io/movementlabsxyz/wait-for-celestia-light-node:c2372ff
63+
6564
# Entrypoint to bootstrap podman and launch mtma
6665
ENTRYPOINT ["/app/entry.sh"]

flake.nix

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -127,21 +127,23 @@
127127
fi
128128
129129
# Check if podman machine exists and is running
130-
if ! podman machine inspect podman-machine-default &>/dev/null; then
131-
echo "Initializing podman machine..."
132-
podman machine init
133-
elif ! podman machine inspect podman-machine-default --format '{{.State}}' | grep -q 'running'; then
134-
echo "Starting podman machine..."
135-
podman machine start
136-
fi
137-
138-
# Find the actual podman socket location
139-
PODMAN_SOCKET=$(find /tmp/nix-shell.*/podman -name "podman-machine-default-api.sock" -type s 2>/dev/null | head -n 1)
140-
if [ -n "$PODMAN_SOCKET" ]; then
141-
export DOCKER_HOST="unix://$PODMAN_SOCKET"
142-
echo "Set DOCKER_HOST to Podman socket: $DOCKER_HOST"
143-
else
144-
echo "Warning: Could not find Podman socket"
130+
if [ "$BUILD" != "docker" ]; then
131+
if ! podman machine inspect podman-machine-default &>/dev/null; then
132+
echo "Initializing podman machine..."
133+
podman machine init
134+
elif ! podman machine inspect podman-machine-default --format '{{.State}}' | grep -q 'running'; then
135+
echo "Starting podman machine..."
136+
podman machine start
137+
fi
138+
139+
# Find the actual podman socket location
140+
PODMAN_SOCKET=$(find /tmp/nix-shell.*/podman -name "podman-machine-default-api.sock" -type s 2>/dev/null | head -n 1)
141+
if [ -n "$PODMAN_SOCKET" ]; then
142+
export DOCKER_HOST="unix://$PODMAN_SOCKET"
143+
echo "Set DOCKER_HOST to Podman socket: $DOCKER_HOST"
144+
else
145+
echo "Warning: Could not find Podman socket"
146+
fi
145147
fi
146148
147149
# Add ./target/debug/* to PATH

util/movement/core/build.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ async fn main() -> Result<(), BuildtimeError> {
88
for container in CONTAINERS {
99
readier.add_image(container.to_string());
1010
}
11-
readier.build().await.map_err(|e| BuildtimeError::Internal(e.into()))?;
11+
12+
// do not ready docker if build is BUILD=docker
13+
if std::env::var("BUILD").unwrap_or_default() != "docker" {
14+
readier.build().await.map_err(|e| BuildtimeError::Internal(e.into()))?;
15+
}
1216

1317
let builder: Buildtime<Noop, Noop> = Buildtime::try_new("movement".to_string())?;
1418
builder.build()?;

0 commit comments

Comments
 (0)