Signed-off-by: xtex <xtexchooser@duck.com>
This commit is contained in:
parent
2bb56e54e8
commit
38b45745e0
9 changed files with 77 additions and 0 deletions
12
.editorconfig
Normal file
12
.editorconfig
Normal file
|
@ -0,0 +1,12 @@
|
|||
# EditorConfig is awesome: https://EditorConfig.org
|
||||
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = false
|
||||
insert_final_newline = false
|
7
.woodpecker.yaml
Normal file
7
.woodpecker.yaml
Normal file
|
@ -0,0 +1,7 @@
|
|||
steps:
|
||||
build:
|
||||
image: bash
|
||||
commands:
|
||||
- podman build --force-rm --squash --tag exozy.me/xtex/xt-bot-wiki .
|
||||
- export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus
|
||||
- systemctl --user restart xt-bot.service
|
14
Containerfile
Normal file
14
Containerfile
Normal file
|
@ -0,0 +1,14 @@
|
|||
FROM docker.io/rustlang/rust:nightly-alpine AS builder
|
||||
RUN apk add bash
|
||||
|
||||
COPY src /build/src
|
||||
COPY ["LICENSE", "Cargo.lock", "Cargo.toml", "container/build.sh", "/build"]
|
||||
WORKDIR /build
|
||||
RUN bash ./build.sh
|
||||
|
||||
FROM docker.io/library/alpine
|
||||
RUN apk add --no-cache musl dcron
|
||||
COPY --from=builder /dist /dist
|
||||
COPY container /dist
|
||||
WORKDIR /dist
|
||||
ENTRYPOINT ["/dist/run.sh"]
|
31
container/build.sh
Executable file
31
container/build.sh
Executable file
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -xe
|
||||
|
||||
# Install rust
|
||||
apk add -U curl musl-dev openssl-dev openssl-libs-static
|
||||
#apk add curl musl-dev gcc openssl-dev openssl-libs-static
|
||||
#curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain nightly
|
||||
# shellcheck source=/dev/null
|
||||
#source "$HOME/.cargo/env"
|
||||
#RUSTFLAGS='-C target-feature=+crt-static'
|
||||
#export RUSTFLAGS
|
||||
|
||||
# Install bot
|
||||
cargo test
|
||||
|
||||
mkdir -p /dist
|
||||
cargo install --root /dist --all-features --bins --path /build
|
||||
rm -f /dist/bin/.crates.toml /dist/bin/.crates2.json
|
||||
|
||||
# Install dinit
|
||||
apk add tar clang llvm make
|
||||
curl --proto '=https' --tlsv1.2 -sSL -o dinit.tar.gz https://github.com/davmac314/dinit/archive/refs/heads/master.tar.gz
|
||||
tar -xf dinit.tar.gz
|
||||
cd dinit-master
|
||||
|
||||
dinitMake=(CXX=clang++ CXX_FOR_BUILD=clang++ 'CXXFLAGS_EXTRA="-O3 --static"' -j"$(nproc)")
|
||||
eval "make ${dinitMake[*]}"
|
||||
eval "make ${dinitMake[*]} check check-igr"
|
||||
eval "make ${dinitMake[*]} DESTDIR=/dist install"
|
||||
rm -rf /dist/usr/share/man
|
1
container/cron.d/mcwzh-croe-diff
Normal file
1
container/cron.d/mcwzh-croe-diff
Normal file
|
@ -0,0 +1 @@
|
|||
0 0 * * * /dist/bin/dinitctl trigger mcwzh-croe-diff
|
3
container/dinit.d/crond
Normal file
3
container/dinit.d/crond
Normal file
|
@ -0,0 +1,3 @@
|
|||
type = process
|
||||
command = crond -s /dist/cron.d -f
|
||||
restart = true
|
2
container/dinit.d/mcwzh-croe-diff
Normal file
2
container/dinit.d/mcwzh-croe-diff
Normal file
|
@ -0,0 +1,2 @@
|
|||
type = trigger
|
||||
command = /dist/bin
|
2
container/dinit.d/xt-bot
Normal file
2
container/dinit.d/xt-bot
Normal file
|
@ -0,0 +1,2 @@
|
|||
type = internal
|
||||
waits-for = crond
|
5
container/run.sh
Executable file
5
container/run.sh
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
PATH=/dist/bin:/dist/sbin:$PATH
|
||||
|
||||
exec dinit -d /dist/dinit.d --container -t xt-bot
|
Reference in a new issue