Merge pull request 'refinement' (#1) from refinement into main
Reviewed-on: #1
31
.github/workflows/docker.yaml
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
name: Build and Push Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Log in to Docker registry
|
||||
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login git.jabuxas.com -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
|
||||
|
||||
- name: Build and push Docker image
|
||||
run: |
|
||||
docker build -t git.jabuxas.com/jabuxas/refinement:latest .
|
||||
docker push git.jabuxas.com/jabuxas/refinement:latest
|
||||
|
||||
- name: Log out of Docker registry
|
||||
run: docker logout git.jabuxas.com
|
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/target
|
1756
Cargo.lock
generated
Normal file
14
Cargo.toml
Normal file
@ -0,0 +1,14 @@
|
||||
[package]
|
||||
name = "refinement"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[profile.release]
|
||||
opt-level = 3
|
||||
lto = true
|
||||
codegen-units = 1
|
||||
panic = 'abort'
|
||||
|
||||
[dependencies]
|
||||
rocket = "0.5.1"
|
||||
rust-embed = "8.5.0"
|
9
Dockerfile
Normal file
@ -0,0 +1,9 @@
|
||||
FROM rustlang/rust:nightly-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN cargo build --release --bin refinement
|
||||
|
||||
CMD ["target/release/refinement"]
|
@ -1,8 +1,8 @@
|
||||
services:
|
||||
web:
|
||||
image: darkhttpd
|
||||
web-server:
|
||||
image: refinement
|
||||
ports:
|
||||
- "28080:80"
|
||||
volumes:
|
||||
- ./dev/:/var/www/htdocs:ro
|
||||
- "8880:8000"
|
||||
environment:
|
||||
ROCKET_ADDRESS: 0.0.0.0
|
||||
restart: unless-stopped
|
||||
|
35
src/main.rs
Normal file
@ -0,0 +1,35 @@
|
||||
#[macro_use]
|
||||
extern crate rocket;
|
||||
|
||||
use std::{borrow::Cow, ffi::OsStr, path::PathBuf};
|
||||
|
||||
use rocket::{http::ContentType, response::content::RawHtml};
|
||||
use rust_embed::Embed;
|
||||
|
||||
#[derive(Embed)]
|
||||
#[folder = "static/"]
|
||||
struct Asset;
|
||||
|
||||
#[get("/")]
|
||||
fn index() -> Option<RawHtml<Cow<'static, [u8]>>> {
|
||||
let asset = Asset::get("index.html")?;
|
||||
Some(RawHtml(asset.data))
|
||||
}
|
||||
|
||||
#[get("/dist/<file..>")]
|
||||
fn dist(file: PathBuf) -> Option<(ContentType, Cow<'static, [u8]>)> {
|
||||
let filename = file.display().to_string();
|
||||
let asset = Asset::get(&filename)?;
|
||||
let content_type = file
|
||||
.extension()
|
||||
.and_then(OsStr::to_str)
|
||||
.and_then(ContentType::from_extension)
|
||||
.unwrap_or(ContentType::Bytes);
|
||||
|
||||
Some((content_type, asset.data))
|
||||
}
|
||||
|
||||
#[launch]
|
||||
fn rocket() -> _ {
|
||||
rocket::build().mount("/", routes![index, dist])
|
||||
}
|
Before Width: | Height: | Size: 9.7 KiB After Width: | Height: | Size: 9.7 KiB |
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 8.7 KiB |
Before Width: | Height: | Size: 491 B After Width: | Height: | Size: 491 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 94 KiB After Width: | Height: | Size: 94 KiB |
@ -5,11 +5,25 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="description" content="jabuxas' website" />
|
||||
<title>jabuxas' hub</title>
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
|
||||
<link rel="manifest" href="/site.webmanifest" />
|
||||
<link href="style.css?version=1" rel="stylesheet" />
|
||||
<link
|
||||
rel="apple-touch-icon"
|
||||
sizes="180x180"
|
||||
href="/dist/apple-touch-icon.png"
|
||||
/>
|
||||
<link
|
||||
rel="icon"
|
||||
type="image/png"
|
||||
sizes="32x32"
|
||||
href="/dist/favicon-32x32.png"
|
||||
/>
|
||||
<link
|
||||
rel="icon"
|
||||
type="image/png"
|
||||
sizes="16x16"
|
||||
href="/dist/favicon-16x16.png"
|
||||
/>
|
||||
<link rel="manifest" href="/dist/site.webmanifest" />
|
||||
<link href="/dist/style.css?version=1" rel="stylesheet" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@ -17,7 +31,7 @@
|
||||
<div class="top-level">
|
||||
<div>
|
||||
<div class="image-container">
|
||||
<img src="./images/maybe.jpg" alt="jabuxas' icon" />
|
||||
<img src="/dist/images/maybe.jpg" alt="jabuxas' icon" />
|
||||
</div>
|
||||
<h2>jabuxas</h2>
|
||||
</div>
|