-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding Dockerfile for production usage
- Loading branch information
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Use the official Rust image as the base image | ||
FROM rust:latest AS builder | ||
|
||
# Set the working directory | ||
WORKDIR /usr/src/app | ||
|
||
# Copy the Cargo.toml and Cargo.lock files | ||
COPY Cargo.toml Cargo.lock ./ | ||
|
||
# Copy the source code | ||
COPY . . | ||
|
||
# Build the application | ||
RUN cargo build --release | ||
|
||
# Use a minimal base image for the final stage | ||
FROM debian:buster-slim | ||
|
||
# Set the working directory | ||
WORKDIR /usr/src/app | ||
|
||
# Copy the built binary from the builder stage | ||
COPY --from=builder /usr/src/app/target/release/x_bot . | ||
|
||
# Expose the port the app runs on | ||
EXPOSE 7878 | ||
|
||
# Run the application | ||
CMD ["./x_bot"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters