deploy update
Some checks failed
build / docker (push) Failing after 13m24s

This commit is contained in:
Wyatt J. Miller 2025-04-19 21:07:25 -04:00
parent a98f2498a3
commit 6729de6d93
6 changed files with 153 additions and 62 deletions

55
.github/workflows/build.yml vendored Normal file
View 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
View File

@ -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"

View File

@ -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
View 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
View 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

View File

@ -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,51 +13,53 @@
}; };
}; };
outputs = {
outputs = { self, flake-schemas, nixpkgs, rust-overlay }: self,
let flake-schemas,
nixpkgs,
overlays = [ rust-overlay,
rust-overlay.overlays.default }: let
(final: prev: { overlays = [
rustToolchain = final.rust-bin.stable.latest.default.override { extensions = [ "rust-src"]; }; rust-overlay.overlays.default
}) (final: prev: {
]; 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; [
rustToolchain
packages = with pkgs; [ cargo-bloat
rustToolchain cargo-edit
cargo-bloat cargo-outdated
cargo-edit cargo-udeps
cargo-outdated cargo-watch
cargo-udeps rust-analyzer
cargo-watch curl
rust-analyzer git
curl jq
git wget
jq nixpkgs-fmt
wget pkg-config-unwrapped
nixpkgs-fmt 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";
};
}; };
}); };
}; });
};
} }