-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
28 lines (24 loc) · 1003 Bytes
/
Dockerfile
File metadata and controls
28 lines (24 loc) · 1003 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
FROM rust:1-alpine3.22 AS rust-builder
# Download all dependencies needed for compilation
RUN apk add --no-cache make musl-dev
ADD https://github.com/tailwindlabs/tailwindcss/releases/download/v4.1.17/tailwindcss-linux-x64-musl /build/tailwindcss-linux-x64
# Create a dummy program with our Cargo dependencies so they're cached by Docker
WORKDIR /build
COPY ./Cargo.toml .
COPY ./Cargo.lock .
RUN mkdir ./src && echo 'fn main() { println!("Dummy!"); }' > ./src/main.rs
RUN cargo build --release
RUN rm -rf ./src
RUN rm -f ./target/release/malwarepad-files
# Build the final executable inside this full environment
COPY . /build
RUN touch -a -m ./src/main.rs
RUN chmod +x ./tailwindcss-linux-x64
RUN make build
# Finalize process with a target image which is as lean as it gets
FROM alpine:3.22
WORKDIR /build
COPY --exclude=target/ --exclude=tailwindcss-linux-x64 --from=rust-builder /build/ .
COPY --from=rust-builder /build/target/release/malwarepad-files .
EXPOSE 8080
CMD ["./malwarepad-files"]