Skip to content

Commit

Permalink
build script reports errors with tailwind
Browse files Browse the repository at this point in the history
  • Loading branch information
Joeyh021 committed Aug 25, 2023
1 parent 4fbb514 commit 37ef179
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 29 deletions.
5 changes: 2 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
DATABASE_URL=postgres://test:test@localhost:5432/test
PORT=8000
DATABASE_URL=postgres://go2:bananas@localhost:5432/go2
API_SECRET=super_secret
AUTH_CLIENT_ID=client_id
AUTH_CLIENT_SECRET=client_secret
AUTH_OIDC_URL=https://auth.uwcs.co.uk/realms/uwcs/
APP_URL=http://localhost:8080
APP_URL=http://localhost:8080
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ COPY ./.sqlx ./.sqlx
COPY ./migrations ./migrations
COPY ./templates ./templates
COPY ./static ./static
COPY tailwind.config.js tailwind.config.js

# build our code
RUN rm ./target/release/deps/go2*
Expand Down
21 changes: 15 additions & 6 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use std::env;
use std::path::{Path, PathBuf};
use std::{env, process::Output};
use which::which;

// Example custom build script.
fn main() {
// Tell Cargo that if the given file changes, to rerun this build script.
println!("cargo:rerun-if-changed=templates/*");
println!("cargo:rerun-if-changed=templates/");
println!("cargo:rerun-if-changed=static/styles.css");
println!("cargo:rerun-if-changed=tailwind.config.js");
if let Some(exe) = find_tailwind() {
Expand All @@ -30,9 +30,18 @@ fn run_tailwind(exe: &Path) {
.arg("-o")
.arg("static/output.css")
.arg("--minify")
.output()
.map(|_| ());
if let Err(e) = result {
panic!("Failed to run tailwindcss: {}", e)
.output();

match result {
Ok(Output {
status,
stdout: _,
stderr,
}) if !status.success() => panic!(
"tailwindcss exited with error: {}",
String::from_utf8_lossy(&stderr)
),
Err(e) => panic!("Failed to run tailwindcss: {}", e),
_ => (),
}
}
22 changes: 2 additions & 20 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,6 @@
version: "3"

services:
go2:
container_name: go2
build: .
environment:
DATABASE_URL: postgres://go2:bananas@localhost:5432/go2
PORT: 8080
API_SECRET: super_secret
AUTH_CLIENT_ID: foo
AUTH_CLIENT_SECRET: bar
AUTH_OIDC_URL: http://localhost:8081/
APP_URL: http://localhost:8080
restart: on-failure
network_mode: host
depends_on:
- db
- auth


db:
image: postgres:14.7
ports:
Expand All @@ -29,7 +11,7 @@ services:
POSTGRES_PASSWORD: bananas
volumes:
- postgres_data:/var/lib/postgresql/data

auth:
image: qlik/simple-oidc-provider
ports:
Expand All @@ -40,4 +22,4 @@ services:
IDP_NAME: http://localhost:8081/

volumes:
postgres_data:
postgres_data:

0 comments on commit 37ef179

Please sign in to comment.