build: add docker build files

This commit is contained in:
Alexander Navarro 2025-03-12 15:11:48 -03:00
parent 1871610770
commit 3c2d3cf720
6 changed files with 262 additions and 23 deletions

View file

@ -3,6 +3,8 @@ mod repo ".devfiles/justfile"
set dotenv-load := true
release_mode := "dev"
[private]
docker-compose +ARGS:
docker compose --file .devfiles/docker/docker-compose.dev.yaml --env-file .env --project-name compendium {{ARGS}}
@ -10,7 +12,14 @@ docker-compose +ARGS:
start-dev-services: (docker-compose "up --remove-orphans")
dev:
watchexec --no-vcs-ignore --clear --restart --watch=dist --watch=src cargo run
watchexec --no-vcs-ignore --clear --restart --watch=dist --watch=src cargo run {{ if release_mode == "prod" { "--release" } else { "" } }}
kitty-dev:
kitten @ goto-layout tall
kitten @ launch --cwd=current --dont-take-focus just build-frontend-watch
kitten @ launch --cwd=current --dont-take-focus just start-dev-services
kitten @ launch --cwd=current --dont-take-focus just dev
nvim ./src/main.rs
migrate: (docker-compose "run dbmate migrate")
@ -20,24 +29,4 @@ build-frontend-watch:
watchexec --restart --watch frontend just build-frontend
build-frontend:
#!/usr/bin/env bun
import sassPlugin from "@alecodes/bun-plugin-sass";
const entrypoints = Array.from(
new Bun.Glob("frontend/**/*.html").scanSync(".")
);
const result = await Bun.build({
entrypoints,
outdir: "dist",
publicPath: "/",
splitting: true,
plugins: [sassPlugin],
naming: {
entry: "[dir]/[name].[ext]",
chunk: "assets/[name]-[hash].[ext]",
asset: "assets/[name]-[hash].[ext]",
},
});
console.log("Assets compiled!");
bun ./.devfiles/scripts/build-frontend.ts