Skip to content

Commit aacd08d

Browse files
committed
Updated website
1 parent 0ee81be commit aacd08d

56 files changed

Lines changed: 10103 additions & 4 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,8 @@ vscode-extension/*.vsix
2121

2222
# Playground (has its own .gitignore)
2323
playground/target/
24+
25+
# Website (Astro)
26+
website/node_modules/
27+
website/dist/
28+
website/.astro/

Dockerfile

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Build context is the repo root
2+
# Deploy: git archive --format=tar.gz -o /tmp/deploy.tar.gz HEAD
3+
4+
# Stage 1: Build all Rust artifacts (WASM + backend binary)
5+
FROM rust:1.88-bookworm AS rust-builder
6+
RUN cargo install wasm-pack --locked
7+
WORKDIR /app
8+
COPY playground/Cargo.toml playground/Cargo.lock ./
9+
COPY playground/wasm/ wasm/
10+
COPY playground/backend/ backend/
11+
RUN cd wasm && wasm-pack build --target web --release --out-dir /app/wasm-pkg
12+
RUN cargo build --release -p solscript-playground
13+
14+
# Stage 2: Build Vue frontend
15+
FROM node:20-alpine AS frontend-builder
16+
WORKDIR /app
17+
COPY playground/frontend/package*.json ./
18+
RUN npm ci
19+
COPY playground/frontend/ ./
20+
COPY --from=rust-builder /app/wasm-pkg/ ./src/wasm-pkg/
21+
RUN npm run build
22+
23+
# Stage 3: Build Astro site
24+
FROM node:20-alpine AS astro-builder
25+
WORKDIR /app
26+
COPY website/package*.json ./
27+
RUN npm ci
28+
COPY website/ ./
29+
RUN npm run build
30+
31+
# Stage 4: Runtime (lean — no Solana toolchain yet)
32+
FROM debian:bookworm-slim
33+
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
34+
COPY --from=rust-builder /app/target/release/solscript-playground /usr/local/bin/
35+
COPY --from=frontend-builder /app/dist/ /app/playground/
36+
COPY --from=astro-builder /app/dist/ /app/astro/
37+
38+
ENV PLAYGROUND_DIR=/app/playground
39+
ENV ASTRO_DIR=/app/astro
40+
ENV PORT=3000
41+
ENV RUST_LOG=info
42+
EXPOSE 3000
43+
CMD ["solscript-playground"]

captain-definition

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"schemaVersion": 2,
3+
"dockerfilePath": "./Dockerfile"
4+
}

playground/backend/src/main.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,23 @@ async fn main() {
1616
.with_env_filter(EnvFilter::from_default_env().add_directive("info".parse().unwrap()))
1717
.init();
1818

19-
let static_dir =
20-
std::env::var("STATIC_DIR").unwrap_or_else(|_| "../frontend/dist".to_string());
19+
let playground_dir =
20+
std::env::var("PLAYGROUND_DIR").unwrap_or_else(|_| "../frontend/dist".to_string());
21+
let astro_dir =
22+
std::env::var("ASTRO_DIR").unwrap_or_else(|_| "../../website/dist".to_string());
2123

2224
let api_routes = Router::new()
2325
.route("/api/build", post(routes::build))
2426
.route("/api/health", get(routes::health));
2527

26-
let spa_fallback = ServeFile::new(format!("{}/index.html", static_dir));
28+
let spa_fallback = ServeFile::new(format!("{}/index.html", playground_dir));
29+
let playground_service = ServeDir::new(&playground_dir).fallback(spa_fallback);
30+
31+
let astro_service = ServeDir::new(&astro_dir);
2732

2833
let app = api_routes
29-
.fallback_service(ServeDir::new(&static_dir).fallback(spa_fallback))
34+
.nest_service("/playground", playground_service)
35+
.fallback_service(astro_service)
3036
.layer(CorsLayer::permissive());
3137

3238
let port: u16 = std::env::var("PORT")

playground/frontend/vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import vue from '@vitejs/plugin-vue'
33
import tailwindcss from '@tailwindcss/vite'
44

55
export default defineConfig({
6+
base: '/playground/',
67
plugins: [vue(), tailwindcss()],
78
server: {
89
proxy: {

website/astro.config.mjs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { defineConfig } from 'astro/config';
2+
import sitemap from '@astrojs/sitemap';
3+
import tailwindcss from '@tailwindcss/vite';
4+
5+
export default defineConfig({
6+
site: 'https://solscript.cryptuon.com',
7+
output: 'static',
8+
integrations: [
9+
sitemap({
10+
filter: (page) => !page.includes('/playground'),
11+
}),
12+
],
13+
vite: {
14+
plugins: [tailwindcss()],
15+
},
16+
markdown: {
17+
shikiConfig: {
18+
themes: {
19+
light: 'github-light',
20+
dark: 'github-dark',
21+
},
22+
},
23+
},
24+
});

0 commit comments

Comments
 (0)