feat: add Docker build pipeline

This commit is contained in:
2024-12-19 17:49:22 +01:00
parent e9a5136c8d
commit f7743cc6d0
3 changed files with 66 additions and 1 deletions

27
Dockerfile Normal file
View File

@@ -0,0 +1,27 @@
# 1. This tells docker to use the Rust official image
FROM rustlang/rust:nightly-bullseye as BUILDER
# Define WORKDIR
WORKDIR /build
# 2. Copy the files in your machine to the Docker image
COPY ./ ./
# Build your program for release
RUN cargo build --release
# Runner Step
FROM rustlang/rust:nightly-bullseye as RUNNER
# Define WORKDIR
WORKDIR /app
# Copy Binary and License
COPY --from=BUILDER /build/target/release/rustysearch /app/
COPY --from=BUILDER /build/LICENSE /app/
# Expose Port
EXPOSE 4000
# Run the binary
CMD ["/app/rustysearch"]