This commit is contained in:
parent
a98f2498a3
commit
6729de6d93
55
.github/workflows/build.yml
vendored
Normal file
55
.github/workflows/build.yml
vendored
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
name: build
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: ["master"]
|
||||||
|
pull_request:
|
||||||
|
branches: ["master"]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Log in to the Container registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: scm.wyattjmiller.com
|
||||||
|
username: ${{ secrets.GH_ACTION_USERNAME }}
|
||||||
|
password: ${{ secrets.GH_ACTION_TOKEN }}
|
||||||
|
|
||||||
|
- name: Extract metadata (tags, labels) for Docker
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: scm.wyattjmiller.com/wymiller/caitsith
|
||||||
|
tags: |
|
||||||
|
type=sha,prefix=
|
||||||
|
type=ref,event=branch
|
||||||
|
type=ref,event=pr
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
|
||||||
|
- name: Build and test Docker image
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
target: test
|
||||||
|
push: false
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
|
||||||
|
- name: Build and push production Docker image
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
target: production
|
||||||
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
|
tags: scm.wyattjmiller.com/wymiller/caitsith
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
32
Cargo.lock
generated
32
Cargo.lock
generated
@ -1,6 +1,6 @@
|
|||||||
# This file is automatically @generated by Cargo.
|
# This file is automatically @generated by Cargo.
|
||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
version = 3
|
version = 4
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "addr2line"
|
name = "addr2line"
|
||||||
@ -136,6 +136,21 @@ version = "1.10.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a"
|
checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cait-sith"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"chrono",
|
||||||
|
"dotenvy",
|
||||||
|
"rand 0.8.5",
|
||||||
|
"reqwest 0.12.15",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"serenity",
|
||||||
|
"tokio",
|
||||||
|
"tracing",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "camino"
|
name = "camino"
|
||||||
version = "1.1.9"
|
version = "1.1.9"
|
||||||
@ -1786,21 +1801,6 @@ dependencies = [
|
|||||||
"uwl",
|
"uwl",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "setzer"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"chrono",
|
|
||||||
"dotenvy",
|
|
||||||
"rand 0.8.5",
|
|
||||||
"reqwest 0.12.15",
|
|
||||||
"serde",
|
|
||||||
"serde_json",
|
|
||||||
"serenity",
|
|
||||||
"tokio",
|
|
||||||
"tracing",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sha1"
|
name = "sha1"
|
||||||
version = "0.10.6"
|
version = "0.10.6"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "setzer"
|
name = "cait-sith"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
|
17
Dockerfile
Normal file
17
Dockerfile
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# Build stage
|
||||||
|
FROM rust:1.86 as builder
|
||||||
|
WORKDIR /usr/src/app
|
||||||
|
COPY . .
|
||||||
|
RUN cargo build --release
|
||||||
|
|
||||||
|
# Test stage
|
||||||
|
FROM builder as test
|
||||||
|
RUN cargo test
|
||||||
|
|
||||||
|
# Production stage
|
||||||
|
FROM debian:bookworm-slim as production
|
||||||
|
WORKDIR /usr/src/app
|
||||||
|
RUN apt update -q
|
||||||
|
RUN apt install openssl -y -q
|
||||||
|
COPY --from=builder /usr/src/app/target/release/cait-sith .
|
||||||
|
CMD ["./cait-sith"]
|
19
docker-compose.yml
Normal file
19
docker-compose.yml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
version: "3"
|
||||||
|
services:
|
||||||
|
caitsith-discord-bot:
|
||||||
|
image: scm.wyattjmiller.com/wymiller/caitsith:latest
|
||||||
|
environment:
|
||||||
|
VIRTUAL_HOST: caitsith.discord.wyattjmiller.com
|
||||||
|
VIRTUAL_PORT: 80
|
||||||
|
LETSENCRYPT_HOST: caitsith.discord.wyattjmiller.com
|
||||||
|
LETSENCRYPT_EMAIL: wjmiller2016@gmail.com
|
||||||
|
## Fill these in when you deploy
|
||||||
|
# GUILD_ID:
|
||||||
|
# DISCORD_TOKEN:
|
||||||
|
expose:
|
||||||
|
- 80
|
||||||
|
|
||||||
|
networks:
|
||||||
|
default:
|
||||||
|
external:
|
||||||
|
name: nginx-proxy
|
32
flake.nix
32
flake.nix
@ -1,9 +1,7 @@
|
|||||||
# This flake was initially generated by fh, the CLI for FlakeHub (version 0.1.18)
|
# This flake was initially generated by fh, the CLI for FlakeHub (version 0.1.18)
|
||||||
{
|
{
|
||||||
|
|
||||||
description = "A dice roller bot";
|
description = "A dice roller bot";
|
||||||
|
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/*";
|
flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/*";
|
||||||
|
|
||||||
@ -15,30 +13,30 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
outputs = {
|
||||||
outputs = { self, flake-schemas, nixpkgs, rust-overlay }:
|
self,
|
||||||
let
|
flake-schemas,
|
||||||
|
nixpkgs,
|
||||||
|
rust-overlay,
|
||||||
|
}: let
|
||||||
overlays = [
|
overlays = [
|
||||||
rust-overlay.overlays.default
|
rust-overlay.overlays.default
|
||||||
(final: prev: {
|
(final: prev: {
|
||||||
rustToolchain = final.rust-bin.stable.latest.default.override { extensions = [ "rust-src"]; };
|
rustToolchain = final.rust-bin.stable.latest.default.override {extensions = ["rust-src"];};
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
|
supportedSystems = ["x86_64-linux" "aarch64-darwin" "aarch64-linux"];
|
||||||
supportedSystems = [ "x86_64-linux" "aarch64-darwin" "aarch64-linux" ];
|
forEachSupportedSystem = f:
|
||||||
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
|
nixpkgs.lib.genAttrs supportedSystems (system:
|
||||||
pkgs = import nixpkgs { inherit overlays system; };
|
f {
|
||||||
|
pkgs = import nixpkgs {inherit overlays system;};
|
||||||
});
|
});
|
||||||
in {
|
in {
|
||||||
|
|
||||||
schemas = flake-schemas.schemas;
|
schemas = flake-schemas.schemas;
|
||||||
|
|
||||||
|
devShells = forEachSupportedSystem ({pkgs}: {
|
||||||
devShells = forEachSupportedSystem ({ pkgs }: {
|
|
||||||
default = pkgs.mkShell {
|
default = pkgs.mkShell {
|
||||||
|
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
rustToolchain
|
rustToolchain
|
||||||
cargo-bloat
|
cargo-bloat
|
||||||
@ -52,12 +50,14 @@
|
|||||||
jq
|
jq
|
||||||
wget
|
wget
|
||||||
nixpkgs-fmt
|
nixpkgs-fmt
|
||||||
|
pkg-config-unwrapped
|
||||||
|
openssl.dev
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
env = {
|
env = {
|
||||||
RUST_BACKTRACE = "1";
|
RUST_BACKTRACE = "1";
|
||||||
RUST_SRC_PATH = "${pkgs.rustToolchain}/lib/rustlib/src/rust/library";
|
RUST_SRC_PATH = "${pkgs.rustToolchain}/lib/rustlib/src/rust/library";
|
||||||
|
PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user