Skip to content

Commit d6a3fca

Browse files
committed
fix: Replace curl healthchecks with netcat port checks
- Use nc -z instead of curl to avoid triggering Lambda invocations during healthchecks - Update Rust base image from 1.83 to 1.85 - Add volume mounts for hot-reload development - Set cargo-lambda install to quiet mode - Standardize Docker configuration for development workflow
1 parent ecb8bc1 commit d6a3fca

File tree

3 files changed

+21
-12
lines changed

3 files changed

+21
-12
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
- name: Wait for lambda healthcheck
5252
run: |
5353
for i in {1..20}; do
54-
curl -sSf http://localhost:9000 && break || sleep 3
54+
timeout 2 nc -z localhost 9000 && break || sleep 3
5555
done
5656
5757
- name: Run integration tests

Dockerfile.lambda-runtime

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM rust:1.83-slim
1+
FROM rust:1.85-slim
22

33
# Install system deps for building Rust packages and running cargo-lambda
44
RUN apt-get update && apt-get install -y \
@@ -13,12 +13,13 @@ RUN apt-get update && apt-get install -y \
1313
ENV PATH="/usr/local/cargo/bin:${PATH}"
1414

1515
# Install cargo-lambda
16-
RUN cargo install cargo-lambda --version 1.8.5 --locked
16+
RUN cargo install cargo-lambda --version 1.8.5 --locked --quiet
1717

1818
# Default user
1919
RUN useradd -m dev
20-
USER dev
2120
WORKDIR /app
2221

23-
# Entry point optional
24-
CMD ["bash"]
22+
USER root
23+
24+
# Entry point overriden by docker-compose.yml
25+
CMD [ "bash" ]

docker-compose.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
11

22
services:
33
lambda:
4+
user: root # We're currently in dev mode so this is Ok, don't do this for production
45
build:
56
context: .
67
dockerfile: Dockerfile.lambda-runtime
7-
environment:
8-
RUST_LOG=info
98
ports:
109
- "9000:9000"
10+
volumes:
11+
- ./src:/app/src # hot-reload watch point
12+
- ./Cargo.toml:/app/Cargo.toml
13+
- ./Cargo.lock:/app/Cargo.lock
14+
- ${CR8S_SCRATCH_DIR:-/var/tmp}/aws/dev-cargo:/usr/local/cargo/registry
15+
- ${CR8S_SCRATCH_DIR:-/var/tmp}/aws/dev-target:/app/target
16+
environment:
17+
RUST_LOG: info
1118
healthcheck:
12-
test: ["CMD", "curl", "-f", "http://localhost:9000"]
13-
interval: 5s
14-
timeout: 2s
15-
retries: 10
19+
test: ["CMD", "nc", "-z", "localhost", "9000"]
20+
interval: 5s
21+
timeout: 2s
22+
retries: 10
23+
command: [ "cargo", "lambda", "watch" ]

0 commit comments

Comments
 (0)