BotDiscord/Dockerfile
2024-06-28 02:09:22 +02:00

33 lines
759 B
Docker

FROM rust:latest AS builder
WORKDIR /app
# Copy the Cargo.toml and build the project to cache dependencies
COPY Cargo.toml .
RUN mkdir src &&\
echo "fn main() {}" > src/main.rs
RUN cargo build --release
# Copy the rest of the source code then build the project
COPY src src
RUN touch src/main.rs
RUN cargo build --release
# Strip the binaries to reduce size
RUN strip target/release/botdiscord
#FROM alpine:latest as release
FROM gcr.io/distroless/cc-debian12
WORKDIR /app
# Copy each binary from the builder stage, all needed for different stages
COPY --from=builder /app/target/release/botdiscord .
# Copy the resource folder that containt default configuration files
COPY ./resources ./resources
ENV PORT 5437
EXPOSE 5437
CMD ["./botdiscord"]