did some docker stuff ; deploy this shit .
Some checks failed
Deploy / build-and-deploy (push) Failing after 22m33s

This commit is contained in:
2025-07-06 11:17:22 +02:00
parent 7629164387
commit 6665f65529
4 changed files with 56 additions and 106 deletions

View File

@@ -10,10 +10,43 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout repository - name: Checkout repository
run: actions/checkout@v3 uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'
- name: Install Node.js dependencies
run: npm ci
- name: Run ESLint
run: npm run lint
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
- name: Cache Rust dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
markdown_backend/target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Check Rust code
working-directory: markdown_backend
run: cargo check
- name: Install Docker - name: Install Docker
run: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
- name: Build Docker image - name: Build Docker image
run: docker build -t markdownblog . run: docker build -t markdownblog .
@@ -22,7 +55,10 @@ jobs:
run: docker save markdownblog -o markdownblog-image.tar run: docker save markdownblog -o markdownblog-image.tar
- name: Upload Docker image artifact - name: Upload Docker image artifact
run: actions/upload-artifact@v3 --name markdownblog-docker-image --path markdownblog-image.tar uses: actions/upload-artifact@v3
with:
name: markdownblog-docker-image
path: markdownblog-image.tar
- name: Push Docker image - name: Push Docker image
run: docker push 10.0.0.13:3002/rattatwinko/markdownblog:latest run: docker push localhost:3002/rattatwinko/markdownblog:latest

View File

@@ -45,4 +45,4 @@ if ! docker ps | grep -q $CONTAINER_NAME; then
fi fi
echo "Deployment complete!" echo "Deployment complete!"
echo "App should be available at http://localhost:$PORT" echo "App should be available at http://localhost:$PORT"

View File

@@ -1,101 +0,0 @@
project_setup:
description: Setup Rust and Next.js to compile Rust to WASM for web use
prerequisites:
- Node.js >= 18
- Rust >= 1.70
- wasm-pack installed (`cargo install wasm-pack`)
- Next.js app created (`npx create-next-app@latest`)
- Optional: TypeScript enabled
steps:
- name: Create Rust crate
run: |
mkdir rust-wasm
cd rust-wasm
cargo new --lib wasm_core
cd wasm_core
- name: Add wasm dependencies to Cargo.toml
file: rust-wasm/wasm_core/Cargo.toml
append:
dependencies:
wasm-bindgen: "0.2"
[lib]:
crate-type: ["cdylib"]
[package.metadata.wasm-pack.profile.release]
wasm-opt: true
- name: Write simple Rust function
file: rust-wasm/wasm_core/src/lib.rs
content: |
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub fn greet(name: &str) -> String {
format!("Hello, {}!", name)
}
- name: Build WASM module with wasm-pack
run: |
cd rust-wasm/wasm_core
wasm-pack build --target web --out-dir ../pkg
nextjs_setup:
description: Integrate the WASM output into a Next.js app
steps:
- name: Move compiled WASM pkg to Next.js public or static
run: |
# Assuming your Next.js app is in ../my-app
mkdir -p ../my-app/public/wasm
cp -r ../rust-wasm/pkg/* ../my-app/public/wasm/
- name: Import and initialize WASM in React
file: my-app/app/page.tsx
content: |
'use client';
import { useEffect, useState } from "react";
export default function Home() {
const [output, setOutput] = useState("");
useEffect(() => {
(async () => {
const wasm = await import("../../public/wasm/wasm_core.js");
await wasm.default(); // init
const result = wasm.greet("Next.js + Rust");
setOutput(result);
})();
}, []);
return <div className="p-4 font-mono text-xl">{output}</div>;
}
- name: Add TypeScript support (optional)
tips:
- Type declarations are not emitted automatically by wasm-pack
- You can write your own `.d.ts` file for the exposed functions
example_file: my-app/types/wasm_core.d.ts
content: |
declare module "public/wasm/wasm_core.js" {
export function greet(name: string): string;
export default function init(): Promise<void>;
}
- name: Optimize WebAssembly (optional)
tips:
- Install `binaryen` to use `wasm-opt`
- Run `wasm-pack build --release` with `wasm-opt` enabled
- Produces smaller, faster WASM binaries
dev_commands:
- command: cargo install wasm-pack
description: Install wasm-pack for building to WebAssembly
- command: wasm-pack build --target web
description: Build the Rust crate into WASM + JS bindings for browser
- command: npm run dev
description: Start your Next.js frontend
optional_advanced:
- name: Use `wasm-bindgen` directly (without wasm-pack)
reason: More control over output but more setup required
- name: Use `next-transpile-modules` to load WASM via import from `pkg/`
reason: Allows more direct integration but may need webpack tuning

15
tooling/ascii.py Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/python
from pyfiglet import Figlet
import sys
def asciiart(text: str) -> str:
f = Figlet(font="slant")
return f.renderText(text)
if __name__ == "__main__":
if len(sys.argv) != 2:
print("Usage: python ascii.py \"TEXT\"")
sys.exit(1)
text = sys.argv[1]
print(asciiart(text))