Skip to content

Commit

Permalink
fix(workspaces): better build script and readme along with other fixes:
Browse files Browse the repository at this point in the history
fix: global build errors and warnings
  • Loading branch information
IncognitoTGT committed Jan 13, 2025
1 parent 68da23f commit 70be4d4
Show file tree
Hide file tree
Showing 14 changed files with 95 additions and 79 deletions.
2 changes: 1 addition & 1 deletion apps/web/next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const nextConfig: NextConfig = {
BUILD_DATE: Date.now().toString(),
},
experimental: {
ppr: true,
ppr: "incremental",
typedRoutes: true,
webpackBuildWorker: true,
reactCompiler: true,
Expand Down
1 change: 0 additions & 1 deletion apps/web/src/app/(main)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,3 @@ export default async function Dashboard() {
</div>
);
}
export const experimental_ppr = false;
2 changes: 1 addition & 1 deletion apps/web/src/app/api/session/[slug]/files/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export async function GET(req: NextRequest, props: { params: Promise<{ slug: str
}
const { data, error } = await nodeSession.files.list.get();
if (error) return Response.json({ error }, { status: 500 });
return data.list;
return Response.json(data.list);
}
export async function PUT(req: NextRequest, props: { params: Promise<{ slug: string }> }) {
const params = await props.params;
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"build": {
"dependsOn": ["^build"],
"inputs": ["$TURBO_DEFAULT$", ".env*"],
"outputs": [".next/**", "!.next/cache/**"],
"outputs": [".next/**", "!.next/cache/**", "stardustd"],
"env": ["CONFIG"]
},
"//#check": {},
Expand Down
16 changes: 16 additions & 0 deletions workspaces/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Stardust Workspaces

These are the Docker images that are used for Stardust Workspaces. They have [Starlight](https://github.com/spaceness/starlight) installed and a VNC server running.

## Building

```bash
pnpm build
```
### Options

`--multi-platform`: Build for both arm64 and amd64. By default, the script builds for your host machine's arch.

`--push`: Push the images to docker registry. This only exists for the GitHub workflow and for devs and serves no purpose to others.

`--quiet`: Suppress logs in the console.
50 changes: 50 additions & 0 deletions workspaces/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
const images = ["chromium", "debian"];
const x64Only = ["pinball"];

import { spawn } from "node:child_process";
import { argv } from "node:process";
const optionalArgs = (a) => (process.argv.includes(a) ? a : "");
function buildImage(image) {
return new Promise((resolve, reject) => {
const multiPlatformBuild = argv.includes("--multi-platform");
const platforms = x64Only.includes(image) ? "linux/amd64" : "linux/amd64,linux/arm64";
const process = spawn(
"docker",
[
"buildx",
"build",
".",
"-f",
`${image}/Dockerfile`,
optionalArgs("--quiet"),
optionalArgs("--push"),
multiPlatformBuild ? "--platform" : "",
multiPlatformBuild ? platforms : "",
"--tag",
`ghcr.io/spaceness/${image}`,
],
{ stdio: "inherit", shell: true },
);
process.on("close", (code) => {
if (code === 0) {
resolve(0);
} else {
console.error(`✨ Stardust: Failed to build ${image} with code ${code}`);
reject(new Error(`Build failed for ${image}`));
}
});

process.on("error", (err) => {
console.error(`✨ Stardust: Error while building ${image}: ${err.message}`);
reject(err);
});
});
}

try {
await Promise.all(images.map(buildImage));
console.log("✨ Stardust: All images built successfully!");
} catch (err) {
console.error("✨ Stardust: One or more builds failed:");
console.error(err);
}
44 changes: 0 additions & 44 deletions workspaces/build.sh

This file was deleted.

19 changes: 0 additions & 19 deletions workspaces/buildx.sh

This file was deleted.

2 changes: 1 addition & 1 deletion workspaces/chromium/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ENV DEBIAN_FRONTEND=noninteractive
COPY ./scripts /opt/stardust/scripts

RUN apt-get update && apt-get install --no-install-recommends -y \
xfonts-75dpi xvfb passwd sudo dbus dbus-x11 libxrandr2 libxext-dev libxrender-dev libxtst-dev \
xfonts-75dpi xvfb passwd sudo dbus dbus-x11 libxrandr2 libxext-dev libxrender-dev libxtst-dev imagemagick x11-apps \
python3 python3-pip xterm git procps python3-numpy xfwm4 xfce4-terminal xfce4-session xfconf xfce4-notifyd \
wget curl inetutils-ping vim tigervnc-tools tigervnc-standalone-server tigervnc-common \
chromium
Expand Down
4 changes: 2 additions & 2 deletions workspaces/debian/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ ENV DEBIAN_FRONTEND=noninteractive
COPY ./scripts /opt/stardust/scripts

RUN apt-get update && apt-get install --no-install-recommends -y \
xfonts-75dpi xvfb passwd sudo dbus dbus-x11 \
libxrandr2 libxext-dev libxrender-dev libxtst-dev python3 python3-pip xterm git procps python3-numpy neofetch \
xfonts-75dpi xvfb passwd sudo dbus dbus-x11 libxrandr2 libxext-dev libxrender-dev libxtst-dev imagemagick x11-apps \
python3 python3-pip xterm git procps python3-numpy neofetch \
xfce4 wget curl xfce4-goodies inetutils-ping firefox-esr chromium gimp remmina remmina-plugin-vnc remmina-plugin-rdp flatpak vim \
tigervnc-tools tigervnc-standalone-server tigervnc-common

Expand Down
14 changes: 14 additions & 0 deletions workspaces/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "workspaces",
"version": "1.0",
"type": "module",
"scripts": {
"build": "node build.js"
},
"dependencies": {
"dockerode": "^4.0.2"
},
"devDependencies": {
"@types/dockerode": "^3.3.32"
}
}
6 changes: 3 additions & 3 deletions workspaces/scripts/vnc-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
mkdir -p /home/stardust/.vnc
touch /home/stardust/.Xresources /home/stardust/.Xauthority
sudo chmod +x /home/stardust/.vnc/xstartup
git clone https://github.com/spaceness/starlight /opt/stardust/starlight
cd /opt/stardust/starlight
sudo npm i -g pnpm
pnpm i
sudo git clone https://github.com/spaceness/starlight /opt/stardust/starlight
cd /opt/stardust/starlight
sudo pnpm install -C /opt/stardust/starlight
4 changes: 2 additions & 2 deletions workspaces/template/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ ENV DEBIAN_FRONTEND=noninteractive
COPY ./scripts /opt/stardust/scripts
# idk if all of these are needed someone fix this - @incognitotgt
RUN apt-get update && apt-get install --no-install-recommends -y \
xfonts-75dpi xvfb passwd sudo dbus dbus-x11 libxrandr2 libxext-dev libxrender-dev libxtst-dev \
python3 python3-pip xterm procps python3-numpy xfwm4 xfce4-terminal xfce4-session xfconf xfce4-notifyd \
xfonts-75dpi xvfb passwd sudo dbus dbus-x11 libxrandr2 libxext-dev libxrender-dev libxtst-dev imagemagick x11-apps \
python3 python3-pip xterm git procps python3-numpy xfwm4 xfce4-terminal xfce4-session xfconf xfce4-notifyd \
wget curl inetutils-ping vim tigervnc-tools tigervnc-standalone-server tigervnc-common \
{{APPLICATION_PACKAGE}}

Expand Down

0 comments on commit 70be4d4

Please sign in to comment.