-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
14 changed files
with
114 additions
and
134 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 |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
.github | ||
.vscode | ||
docs | ||
target | ||
# target | ||
tmp | ||
|
||
# Files | ||
|
This file was deleted.
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
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,2 +1,80 @@ | ||
set export | ||
|
||
export MUSL_TARGET_NAME := "ralertsinua-x86_64-unknown-linux-musl" | ||
export MUSL_DIST := "target/distrib/'${MUSL_TARGET_NAME}'" | ||
export RUST_LOG := "verbose" | ||
export RUST_BACKTRACE := "1" | ||
|
||
# foo := if env_var("RELEASE") == "true" { `get-something-from-release-database` } else { "dummy-value" } | ||
|
||
clean: | ||
rm -rf tests/data/.task tests/data/.config | ||
#!/bin/sh | ||
find target -mindepth 1 -maxdepth 1 ! -name "debug" ! -name "tmp" -exec rm -rf {} + | ||
|
||
docs: | ||
#!/bin/sh | ||
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/oranda/releases/latest/download/oranda-installer.sh | sh | ||
oranda build --config-path docs/oranda.render.json | ||
|
||
[confirm] | ||
publish: | ||
#!/bin/sh | ||
# If crate A depends on crate B, B must come before A in this list | ||
crates=( | ||
ralertsinua-models | ||
ralertsinua-http | ||
ralertsinua-geo | ||
) | ||
for crate in "${crates[@]}"; do | ||
echo "Publishing ${crate}" | ||
( | ||
cd "$crate" | ||
cargo publish --no-verify | ||
) | ||
sleep 20 | ||
done | ||
|
||
[group('build')] | ||
build target_env="gnu": | ||
#!/bin/sh | ||
echo "Building for target_env: ${target_env}" | ||
if [ "{{target_env}}" = "musl" ]; then | ||
# INFO: https://github.com/clux/muslrust?tab=readme-ov-file#filesystem-permissions-on-local-builds | ||
# Filesystem permissions on local builds | ||
# When building locally, the permissions of the musl parts of the ./target artifacts dir will be owned by root and requires sudo rm -rf target/ to clear. This is an intended complexity tradeoff with user builds. | ||
docker run \ | ||
-v cargo-cache:/root/.cargo/registry \ | ||
-v "$PWD:/volume" \ | ||
-e OPENSSL_LIB_DIR=/usr/lib \ | ||
-e OPENSSL_INCLUDE_DIR=/usr/include \ | ||
--rm -it clux/muslrust \ | ||
cargo build --release --no-default-features --features cache,reqwest-rustls-tls | ||
|
||
# Create a directory for the files to be archived | ||
mkdir -p $MUSL_DIST | ||
cp target/x86_64-unknown-linux-musl/release/ralertsinua $MUSL_DIST | ||
cp CHANGELOG.md LICENSE README.md $MUSL_DIST | ||
tar -C target/distrib -cJf target/distrib/$MUSL_TARGET_NAME.tar.xz $MUSL_TARGET_NAME | ||
else | ||
cargo dist build | ||
fi | ||
|
||
find ./target -type f -name 'ralertsinua' -exec du -sh {} \; | ||
|
||
|
||
[group('run')] | ||
run mode="dev": | ||
#!/bin/sh | ||
echo "Running with mode: ${mode}" | ||
if [ "{{mode}}" = "prod" ]; then | ||
if test -f ./target/release/ralertsinua; then | ||
./target/release/ralertsinua | ||
else | ||
echo "Binary not found. Run 'cargo build --release' first." | ||
fi | ||
elif [ "{{mode}}" = "ttyd" ]; then | ||
docker build -f Dockerfile -t ralertsinua-ttyd . | ||
docker run --env-file .env -p 7681:7681 --rm -it ralertsinua-ttyd:latest | ||
else | ||
cargo run | ||
fi |
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,24 +1,25 @@ | ||
FROM raonigabriel/web-terminal | ||
|
||
# Set the OpenSSL lib directory | ||
ENV OPENSSL_LIB_DIR=/usr/lib | ||
ENV OPENSSL_INCLUDE_DIR=/usr/include | ||
|
||
ENV RELEASE_URL=https://github.com/voiceapiai/ralertsinua/releases/latest/download/ralertsinua-x86_64-unknown-linux-musl.tar.xz | ||
ENV RUST_BACKTRACE=1 | ||
|
||
WORKDIR /home/ralertsinua | ||
|
||
COPY ./tmp/ralertsinua . | ||
|
||
RUN mv ralertsinua /usr/local/bin | ||
# COPY /target/x86_64-unknown-linux-musl/release # This is for local testing | ||
# RUN mv ralertsinua /usr/local/bin # This is for local testing | ||
|
||
# # Install the latest musl version of ralertsinua | ||
# ADD $RELEASE_URL ralertsinua.tar.xz | ||
# RUN tar -xvJf ralertsinua.tar.xz && \ | ||
# find . -type f -name 'ralertsinua' -exec mv {} /usr/local/bin/ \; && \ | ||
# rm ralertsinua.tar.xz | ||
# Install the latest musl version of ralertsinua | ||
ADD $RELEASE_URL ralertsinua.tar.xz | ||
RUN tar -xvJf ralertsinua.tar.xz && \ | ||
find . -type f -name 'ralertsinua' -exec mv {} /usr/local/bin/ \; && \ | ||
rm ralertsinua.tar.xz | ||
|
||
HEALTHCHECK CMD ["ralertsinua", "--help"] | ||
|
||
# Comment this line if you don't need ttyd, and then just run ralertsina | ||
# CMD [ "ttyd", "-s", "3", "-t", "titleFixed=Rust alerts.in.ua TUI - ralertsinua", "-t", "rendererType=webgl", "-t", "disableLeaveAlert=true", "ralertsinua" ] | ||
CMD [ "ralertsinua" ] | ||
|
||
# TODO: https://github.com/colinmurphy1/docker-ttyd/blob/main/entrypoint.sh |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.