Fix Dockerfile build and remove camera device requirement
- Simplify build process by removing dummy source step - Fix binary name from camera-trng to camera-qrng - Copy skill.md to fix include_str! error - Remove /dev/video0 device requirement from docker-compose - Allows container to run with CSPRNG fallback when no camera available Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
438e701b99
commit
1bcdfb4023
13
Dockerfile
13
Dockerfile
|
|
@ -14,13 +14,10 @@ WORKDIR /app
|
||||||
|
|
||||||
# Copy manifests first for better caching
|
# Copy manifests first for better caching
|
||||||
COPY Cargo.toml Cargo.lock ./
|
COPY Cargo.toml Cargo.lock ./
|
||||||
|
|
||||||
# Create dummy src to cache dependencies
|
|
||||||
RUN mkdir src && echo "fn main() {}" > src/main.rs
|
|
||||||
RUN cargo build --release && rm -rf src target/release/deps/camera_trng*
|
|
||||||
|
|
||||||
# Copy actual source and build
|
|
||||||
COPY src ./src
|
COPY src ./src
|
||||||
|
COPY skill.md ./
|
||||||
|
|
||||||
|
# Build
|
||||||
RUN cargo build --release
|
RUN cargo build --release
|
||||||
|
|
||||||
# Runtime stage - minimal image
|
# Runtime stage - minimal image
|
||||||
|
|
@ -37,7 +34,7 @@ RUN useradd -m -u 1000 trng
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy binary from builder
|
# Copy binary from builder
|
||||||
COPY --from=builder /app/target/release/camera-trng .
|
COPY --from=builder /app/target/release/camera-qrng .
|
||||||
|
|
||||||
# Set ownership
|
# Set ownership
|
||||||
RUN chown -R trng:trng /app
|
RUN chown -R trng:trng /app
|
||||||
|
|
@ -48,4 +45,4 @@ ENV PORT=8787
|
||||||
|
|
||||||
EXPOSE 8787
|
EXPOSE 8787
|
||||||
|
|
||||||
CMD ["./camera-trng"]
|
CMD ["./camera-qrng"]
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,4 @@ services:
|
||||||
environment:
|
environment:
|
||||||
- PORT=8787
|
- PORT=8787
|
||||||
- RUST_LOG=info
|
- RUST_LOG=info
|
||||||
devices:
|
|
||||||
- /dev/video0:/dev/video0
|
|
||||||
restart: on-failure
|
restart: on-failure
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue