···11-# Building the dashboard is not included in this Dockerfile, but is done by the mise task instead.
22-# This may change later.
11+FROM rust:1-slim-bookworm AS builder
22+33+RUN apt-get update && apt-get install -y pkg-config libssl-dev && rm -rf /var/lib/apt/lists/*
3444-FROM oven/bun:alpine
55WORKDIR /app
66-COPY ./dist/server.js ./
77-COPY scripts/ ./scripts/
88-RUN mkdir -p /app/data/files
99-RUN chown -R bun:bun /app/data
1010-# A link from /app/ to where it used to be, /usr/src/app/
1111-RUN mkdir -p /usr/src/ && ln -s /app /usr/src/app
1261313-# Run the app
1414-USER bun
1515-EXPOSE 3000/tcp
1616-ENTRYPOINT ["bun", "run", "server.js"]
77+COPY ./server-rs ./server-rs
88+99+COPY ./dist ./dist
1010+1111+RUN cd server-rs && cargo build --release
1212+1313+FROM debian:bookworm-slim
1414+WORKDIR /app
1515+1616+RUN apt-get update && apt-get install -y libssl3 ca-certificates && rm -rf /var/lib/apt/lists/*
1717+1818+COPY --from=builder /app/server-rs/target/release/strawmediajuice-server ./server
1919+2020+2121+ENV ROCKET_ADDRESS=0.0.0.0
2222+EXPOSE 3000
2323+2424+CMD ["./server"]
+32-8
Justfile
···11# Variables
22+23docker_image := "strawmelonjuice/strawmediajuice"
34version := "1.2.1"
45···1314 cd server-rs && cargo fmt
14151516# Tailwind
1616-generate-tailwind-styles:
1717+_generate-tailwind-styles:
1718 bun install
1819 cd dashboard && bunx tailwindcss -i ./app.css -o ../dist/dashboard/dashboard.css
1920 cd dashboard && bunx minify ../dist/dashboard/dashboard.css > ../dist/dashboard/dashboard.min.css
20212122# Dashboard Build
2222-build-dashboard: generate-tailwind-styles
2323+build-dashboard: _generate-tailwind-styles
2324 cd dashboard && gleam export typescript-prelude > ./src/prelude.d.ts
2425 cd dashboard && gleam export javascript-prelude > ./src/prelude.mjs
2526 cd dashboard && gleam build --target javascript
···4445 cd server-rs && cargo build
45464647# Dev with Rs backend
4747-dev-rs: build-server
4848- export EXPAND_TERMSIZE=$(tput cols); clear; ./server-rs/target/debug/server-rs
4848+dev: build-server-rs
4949+ export EXPAND_TERMSIZE=$(tput cols); clear; ./server-rs/target/debug/strawmediajuice-server
5050+5151+# Watchexec Dev with Rust backend
5252+watch:
5353+ watchexec -w server-rs -w dashboard -w server \
5454+ -e rs,gleam,ts,css,html \
5555+ --ignore "dist/*" \
5656+ --ignore "dashboard/build/*" \
5757+ -- "just dev"
49585059# Dev with TS backend
5151-dev: build-server
6060+dev-ts: build-server
5261 export EXPAND_TERMSIZE=$(tput cols); clear; bun ./dist/server.js
53625454-# Docker
5555-build-docker: build-server
5656- docker build --pull -t {{docker_image}}:{{version}} .
6363+# Docker with TypeScript backend, deprecated in favor of the upcoming Rust rewritten release.
6464+_build-docker: build-server
6565+ @echo "\033[1;33mWARNING: '_build-docker-ts' is deprecated.\033[0m"
6666+ @echo "New Docker images should be built from the upcoming Rust backend."
6767+ podman build --pull -t {{ docker_image }}:{{ version }} -f ts.Dockerfile .
6868+6969+# Build Docker image
7070+build-podman:
7171+ podman build --pull -t {{ docker_image }}:{{ version }} -f Dockerfile .
7272+7373+# Build and run the podman container locally, typically for devving on the dockerimage.
7474+dev-docker: build-podman
7575+ podman run -it --rm \
7676+ -p 3000:3000 \
7777+ -e ROCKET_PORT=3000 \
7878+ -e INIT_USERNAME=dev \
7979+ -e INIT_PASSWORD=dev \
8080+ {{ docker_image }}:{{ version }}
+13-3
flake.nix
···3535 {
3636 devShells.default = pkgs.mkShell {
3737 buildInputs = with pkgs; [
3838+ # Language tool chains: Rust, Gleam
3839 rustToolchain
3939-4040- bun
4140 gleam
4141+ # Dashboard prepper (and typescript runtime)
4242+ bun
4343+4444+ # For tidying and typing
4245 nodePackages.typescript
4346 nodePackages.prettier
4444- tailwindcss
4747+4848+ # Helpers on OS level
4549 pkg-config
4650 dbus
5151+5252+ # Podman
5353+ podman
5454+5555+ # Runners
5656+ watchexec
4757 just
4858 ];
4959
···11+# Building the dashboard is not included in this Dockerfile, but is done by the mise task instead.
22+# This may change later.
33+44+FROM oven/bun:alpine
55+WORKDIR /app
66+COPY ./dist/server.js ./
77+COPY scripts/ ./scripts/
88+RUN mkdir -p /app/data/files
99+RUN chown -R bun:bun /app/data
1010+# A link from /app/ to where it used to be, /usr/src/app/
1111+RUN mkdir -p /usr/src/ && ln -s /app /usr/src/app
1212+1313+# Run the app
1414+USER bun
1515+EXPOSE 3000/tcp
1616+ENTRYPOINT ["bun", "run", "server.js"]