-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
60 additions
and
79 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
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,57 @@ | ||
FROM --platform=$BUILDPLATFORM oven/bun:1-alpine AS css-builder | ||
WORKDIR /temp | ||
COPY package.json bun.lockb ./ | ||
RUN bun install --frozen-lockfile | ||
COPY gridPlugin.js tailwind.config.js ./ | ||
COPY src ./src | ||
RUN bunx tailwindcss -i ./src/style.css -o ./out.css --minify | ||
|
||
FROM --platform=$BUILDPLATFORM rust:1.80 AS build | ||
|
||
RUN apt-get update && apt-get install --no-install-recommends -y \ | ||
musl-tools \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
ARG TARGETPLATFORM | ||
RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \ | ||
apt-get update && apt-get install --no-install-recommends -y \ | ||
gcc-aarch64-linux-gnu \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& rustup target add aarch64-unknown-linux-musl \ | ||
&& echo "export CC_aarch64_unknown_linux_musl=aarch64-linux-gnu-gcc" >> /etc/profile \ | ||
&& echo "export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-gnu-gcc" >> /etc/profile; \ | ||
elif [ "$TARGETPLATFORM" = "linux/amd64" ]; then \ | ||
rustup target add x86_64-unknown-linux-musl; \ | ||
else \ | ||
echo "Unsupported platform: $TARGETPLATFORM" && exit 1; \ | ||
fi | ||
|
||
# Set up the build environment | ||
WORKDIR /usr/src | ||
RUN USER=root cargo new --bin vesta | ||
WORKDIR /usr/src/vesta | ||
COPY Cargo.toml Cargo.lock ./ | ||
COPY src ./src | ||
|
||
RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \ | ||
. /etc/profile && cargo build --release --target=aarch64-unknown-linux-musl; \ | ||
elif [ "$TARGETPLATFORM" = "linux/amd64" ]; then \ | ||
cargo build --release --target=x86_64-unknown-linux-musl; \ | ||
fi | ||
|
||
FROM scratch | ||
WORKDIR /app | ||
COPY ./static static | ||
COPY --from=css-builder /temp/out.css ./static/style.css | ||
|
||
# Copy the appropriate binary based on the target platform | ||
ARG TARGETPLATFORM | ||
COPY --from=build /usr/src/vesta/target/aarch64-unknown-linux-musl/release/vesta /app/vesta-arm64 | ||
COPY --from=build /usr/src/vesta/target/x86_64-unknown-linux-musl/release/vesta /app/vesta-amd64 | ||
RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \ | ||
mv /app/vesta-arm64 /app/vesta; \ | ||
elif [ "$TARGETPLATFORM" = "linux/amd64" ]; then \ | ||
mv /app/vesta-amd64 /app/vesta; \ | ||
fi | ||
|
||
CMD ["/app/vesta"] |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.