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.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "addr2line"
|
||||
@ -136,6 +136,21 @@ version = "1.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
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]]
|
||||
name = "camino"
|
||||
version = "1.1.9"
|
||||
@ -1786,21 +1801,6 @@ dependencies = [
|
||||
"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]]
|
||||
name = "sha1"
|
||||
version = "0.10.6"
|
||||
|
@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "setzer"
|
||||
name = "cait-sith"
|
||||
version = "0.1.0"
|
||||
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
|
24
flake.nix
24
flake.nix
@ -1,9 +1,7 @@
|
||||
# This flake was initially generated by fh, the CLI for FlakeHub (version 0.1.18)
|
||||
{
|
||||
|
||||
description = "A dice roller bot";
|
||||
|
||||
|
||||
inputs = {
|
||||
flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/*";
|
||||
|
||||
@ -15,10 +13,12 @@
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
outputs = { self, flake-schemas, nixpkgs, rust-overlay }:
|
||||
let
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
flake-schemas,
|
||||
nixpkgs,
|
||||
rust-overlay,
|
||||
}: let
|
||||
overlays = [
|
||||
rust-overlay.overlays.default
|
||||
(final: prev: {
|
||||
@ -26,19 +26,17 @@
|
||||
})
|
||||
];
|
||||
|
||||
|
||||
supportedSystems = ["x86_64-linux" "aarch64-darwin" "aarch64-linux"];
|
||||
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
|
||||
forEachSupportedSystem = f:
|
||||
nixpkgs.lib.genAttrs supportedSystems (system:
|
||||
f {
|
||||
pkgs = import nixpkgs {inherit overlays system;};
|
||||
});
|
||||
in {
|
||||
|
||||
schemas = flake-schemas.schemas;
|
||||
|
||||
|
||||
devShells = forEachSupportedSystem ({pkgs}: {
|
||||
default = pkgs.mkShell {
|
||||
|
||||
packages = with pkgs; [
|
||||
rustToolchain
|
||||
cargo-bloat
|
||||
@ -52,12 +50,14 @@
|
||||
jq
|
||||
wget
|
||||
nixpkgs-fmt
|
||||
pkg-config-unwrapped
|
||||
openssl.dev
|
||||
];
|
||||
|
||||
|
||||
env = {
|
||||
RUST_BACKTRACE = "1";
|
||||
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