@@ -11,22 +11,28 @@ RUN apt-get update && apt-get install -y \
1111 ca-certificates \
1212 && rm -rf /var/lib/apt/lists/*
1313
14- # Copy source code
14+ # Copy all source code, including the pre-built frontend and entrypoint script
1515COPY . .
1616
1717# Build the application with optimizations
1818RUN cargo build --release --bin embucketd
1919
20- # Stage 4 : Final runtime image
20+ # Stage 2 : Final runtime image
2121FROM gcr.io/distroless/cc-debian12 AS runtime
2222
23- # Set working directory
24- USER nonroot:nonroot
2523WORKDIR /app
2624
27- # Copy the binary and required files
25+ # Copy the compiled binary, API spec, frontend build, and entrypoint script
2826COPY --from=builder /app/target/release/embucketd ./embucketd
2927COPY --from=builder /app/rest-catalog-open-api.yaml ./rest-catalog-open-api.yaml
28+ COPY --from=builder /app/frontend/dist ./dist
29+ COPY --from=builder /app/entrypoint.sh /usr/local/bin/entrypoint.sh
30+
31+ # Make the script executable and ensure the nonroot user can modify app files
32+ RUN chmod +x /usr/local/bin/entrypoint.sh && chown -R nonroot:nonroot /app
33+
34+ # Switch to a non-privileged user
35+ USER nonroot:nonroot
3036
3137# Expose port (adjust as needed)
3238EXPOSE 8080
@@ -37,5 +43,7 @@ ENV FILE_STORAGE_PATH=data/
3743ENV BUCKET_HOST=0.0.0.0
3844ENV JWT_SECRET=63f4945d921d599f27ae4fdf5bada3f1
3945
40- # Default command
46+ # Set the entrypoint to our script
47+ ENTRYPOINT ["/usr/local/bin/entrypoint.sh" ]
48+
4149CMD ["./embucketd" ]
0 commit comments