-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: fix dockerfile and github workflows
- Loading branch information
1 parent
b8f86be
commit 2995712
Showing
8 changed files
with
77 additions
and
47 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
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 |
---|---|---|
@@ -1,20 +1,39 @@ | ||
FROM rust:alpine AS build | ||
WORKDIR / | ||
# Build UI | ||
FROM node:20-alpine3.20 as web | ||
|
||
# Copy web folder | ||
COPY ./web ./web | ||
WORKDIR web | ||
Check warning on line 6 in Dockerfile GitHub Actions / build-imageRelative workdir without an absolute workdir declared within the build can have unexpected results if the base image changes
|
||
|
||
# Install requirements | ||
RUN npm i | ||
|
||
# Build | ||
RUN npm run build | ||
|
||
# Build Cup | ||
FROM rust:1.80.1-alpine3.20 AS build | ||
|
||
# Requirements | ||
RUN apk add musl-dev | ||
|
||
RUN USER=root cargo new --bin cup | ||
# Copy rust | ||
WORKDIR /cup | ||
|
||
COPY Cargo.toml Cargo.lock . | ||
RUN cargo build --release | ||
RUN rm -rf src/ | ||
COPY Cargo.toml . | ||
COPY Cargo.lock . | ||
COPY ./src ./src | ||
|
||
# Copy UI from web builder | ||
COPY --from=web /web/dist src/static | ||
|
||
COPY src src | ||
# This is a very bad workaround, but cargo only triggers a rebuild this way for some reason | ||
RUN printf "\n" >> src/main.rs | ||
# Build | ||
RUN cargo build --release | ||
|
||
# Runner | ||
FROM scratch | ||
|
||
# Copy binary | ||
COPY --from=build /cup/target/release/cup /cup | ||
|
||
ENTRYPOINT ["/cup"] |
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 |
---|---|---|
@@ -1,7 +1,32 @@ | ||
#!/bin/sh | ||
#!/bin/bash | ||
|
||
rm -rf src/static | ||
# Arguments | ||
METHOD=$1 | ||
TARGET=$2 | ||
|
||
# Frontend | ||
cd web/ | ||
bun run build | ||
|
||
# Install requirements | ||
npm i | ||
|
||
# Build | ||
npm run build | ||
|
||
# Copy UI to src folder | ||
cp -r dist/ ../src/static | ||
cargo build $@ | ||
|
||
# Check selected method and build | ||
|
||
if [[ $METHOD == 'cargo' ]]; then | ||
echo "Building with cargo..." | ||
cargo build --release | ||
elif [[ $METHOD == 'cargo-dev' ]]; then | ||
echo "Building with cargo using --verbose (dev)..." | ||
elif [[ $METHOD == 'cross' ]]; then | ||
echo "Building with cross for $TARGET..." | ||
cross build --target $TARGET --release | ||
else | ||
echo "Unkown method!" | ||
exit 1 | ||
fi |
Binary file not shown.
Binary file not shown.
This file was deleted.
Oops, something went wrong.