-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(su): add back in dockerfile and fix test toolchain
- Loading branch information
1 parent
5a2b095
commit 9abc184
Showing
3 changed files
with
60 additions
and
8 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,52 @@ | ||
# Stage 1: Build the dynamic binary | ||
FROM rust:1.75.0 as builder | ||
|
||
# Set the working directory in the container | ||
WORKDIR /usr/src/su | ||
|
||
# Install required dependencies for building | ||
RUN apt-get update && apt-get install -y \ | ||
llvm-dev \ | ||
libclang-dev \ | ||
clang \ | ||
librocksdb-dev | ||
|
||
# Copy the manifests | ||
COPY Cargo.toml Cargo.lock ./ | ||
|
||
# This step is to cache your dependencies | ||
RUN mkdir src && \ | ||
echo "fn main() {}" > src/main.rs && \ | ||
cargo build --release && \ | ||
rm -f target/release/deps/su* | ||
|
||
# Now copy the actual source code and build the application | ||
COPY src ./src | ||
COPY migrations ./migrations | ||
RUN cargo build --release | ||
|
||
# The final output binary will be in /usr/src/su/target/release/su | ||
|
||
|
||
# Stage 2: Create the runnable image using the binary | ||
FROM scratch as runner | ||
|
||
# Set the working directory in the container | ||
WORKDIR /app | ||
|
||
# Copy the binary from your local file system to the container | ||
COPY --from=builder /usr/src/su/target/release/su /app/su | ||
|
||
# Copy necessary libraries from the builder | ||
COPY --from=builder /lib/x86_64-linux-gnu/ /lib/x86_64-linux-gnu/ | ||
COPY --from=builder /lib64/ /lib64/ | ||
|
||
# Provide instructions for building the binary | ||
# (This will be displayed when someone runs `docker build`) | ||
LABEL build_instructions="To build just the binary, run the following command: docker build --target builder -t su ." | ||
|
||
# Run the binary - provide args on execution | ||
ENTRYPOINT [ "/app/su" ] | ||
|
||
# Run time command arguments, default is empty | ||
CMD [] |