feat: init

This commit is contained in:
Araozu 2024-10-18 20:49:16 -05:00
commit 2e3fcd109d
7 changed files with 1728 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/target

1645
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

11
Cargo.toml Normal file
View File

@ -0,0 +1,11 @@
[package]
name = "htmxui"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
maud = { version = "0.26.0", features = ["rocket"] }
rocket = "0.5.1"

17
Dockerfile Normal file
View File

@ -0,0 +1,17 @@
# Start with an Alpine base image
FROM alpine:latest
WORKDIR /app
# Copy the binary, public directory, and .env file
COPY target/release/htmxui /app/htmxui
# COPY public /app/public
# COPY .env /app/.env
# Ensure the main binary is executable
RUN chmod +x /app/htmxui
# Set the command to run the main binary
CMD ["/app/htmxui"]

21
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,21 @@
pipeline {
agent {
docker {
reuseNode true
image 'rust:1-alpine'
}
}
stages {
stage('Build release binary') {
steps {
sh 'cargo build --release'
}
}
stage('Profit') {
steps {
sh 'docker-compose down || true'
sh 'docker-compose up -d --build'
}
}
}
}

10
docker-compose.yml Normal file
View File

@ -0,0 +1,10 @@
services:
htmxui:
container_name: htmxui
build:
context: .
dockerfile: Dockerfile
ports:
- "8008:8000"
restart: unless-stopped

23
src/main.rs Normal file
View File

@ -0,0 +1,23 @@
#[macro_use]
extern crate rocket;
use maud::{html, Markup, DOCTYPE};
#[get("/")]
fn index() -> Markup {
html! {
(DOCTYPE)
html lang="es" {
head {}
body {
div {
"Hello, world!"
}
}
}
}
}
#[launch]
fn rocket() -> _ {
rocket::build().mount("/", routes![index])
}