we don't have to commit styles.css, actually
Some checks failed
arche-build-and-publish / gractwo-arche-build-test (push) Failing after 17s

This commit is contained in:
2026-04-08 00:45:13 +02:00
parent 6613ccb239
commit 37c2cf72a3
5 changed files with 15 additions and 15 deletions

View File

@@ -10,7 +10,7 @@ WORKDIR /app
ENV IN_DOCKER=true
# Install host build dependencies.
RUN apk add --no-cache clang lld musl-dev git
RUN apk add --no-cache clang lld musl-dev git gcompat
# Build the application.
# Leverage a cache mount to /usr/local/cargo/registry/
@@ -21,6 +21,7 @@ RUN apk add --no-cache clang lld musl-dev git
# source code into the container. Once built, copy the executable to an
# output directory before the cache mounted /app/target is unmounted.
RUN --mount=type=bind,source=src,target=src \
--mount=type=bind,source=build.rs,target=build.rs \
--mount=type=bind,source=web,target=web \
--mount=type=bind,source=assets,target=assets \
--mount=type=bind,source=askama.toml,target=askama.toml \

View File

@@ -10,14 +10,21 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
if std::env::var("IN_DOCKER").is_err() {
let os = env::var("CARGO_CFG_TARGET_OS").unwrap_or_else(|_| String::from("unknown"));
let arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap_or_else(|_| String::from("unknown"));
let download_url = match (os.as_str(), arch.as_str()) {
("macos", "aarch64") => {
let env = env::var("CARGO_CFG_TARGET_ENV").unwrap_or_else(|_| String::from("unknown"));
let download_url = match (os.as_str(), arch.as_str(), env.as_str()) {
("macos", "aarch64", _) => {
"https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-macos-arm64"
}
("linux", "x86_64") => {
("linux", "x86_64", "musl") => {
"https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-x64-musl"
}
("linux", "x86_64", _) => {
"https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-x64"
}
("linux", "aarch64") => {
("linux", "aarch64", "musl") => {
"https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-arm64-musl"
}
("linux", "aarch64", _) => {
"https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-arm64"
}
_ => return Err(format!("Unsupported platform: {} {}", os, arch).into()),
@@ -40,7 +47,7 @@ fn run_tailwind(bin: &PathBuf) -> Result<(), Box<dyn std::error::Error>> {
let basedir = std::env::var("CARGO_MANIFEST_DIR").unwrap_or_else(|_| ".".into());
let input = Path::new(&basedir).join("web").join("input.css");
let inputstr = input.to_str().unwrap();
let output = Path::new(&basedir).join("web").join("styles.css");
let output = PathBuf::from(env::var("OUT_DIR")?).join("styles.css");
let outputstr = output.to_str().unwrap();
let args = vec!["-i", inputstr, "-o", outputstr, "--minify"];

View File

@@ -1,8 +1,2 @@
arche
=====
Regarding /web/styles.css
The styles.css file, which is generated by a standalone Tailwind binary downloaded and executed automatically within build.rs, is to be committed any time it changes, as without it styling will be broken on the frontend part of the page.
This is in contrast to a perhaps expected approach of gitignoring them and just generating them every build; this is incompatible with building docker images in an efficient way, however, as docker exposes no way to mount directories while retaining ability to write files and execute binaries.

View File

@@ -10,7 +10,7 @@ use crate::website::pages::{index::page_index, notfound::page_notfound};
mod pages;
const STYLES_CSS: &str = include_str!("../../web/styles.css");
const STYLES_CSS: &str = include_str!(concat!(env!("OUT_DIR"), "/styles.css"));
const FAVICON_SVG: &str = include_str!("../../assets/logo.svg");
const FAVICON_X64: &[u8] = include_bytes!("../../assets/logo-x64.png");

File diff suppressed because one or more lines are too long