This commit is contained in:
JMARyA 2024-07-28 16:12:06 +02:00
parent 1e67f223f7
commit 0bdf75446d
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
4 changed files with 58 additions and 2 deletions

View file

@ -0,0 +1,35 @@
name: deploy
on:
push:
branches:
- master
jobs:
deploy:
runs-on: host
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
registry: git.hydrar.de
username: ${{ secrets.registry_user }}
password: ${{ secrets.registry_password }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: git.hydrar.de/synthwrld/synthwave:latest

17
Dockerfile Normal file
View file

@ -0,0 +1,17 @@
FROM rust:buster as builder
COPY . /app
WORKDIR /app
RUN cargo build --release
FROM debian:buster
RUN apt update && apt upgrade -y
RUN apt install -y gnupg ca-certificates openssl
COPY --from=builder /app/target/release/synthwave /synthwave
WORKDIR /
CMD ["/synthwave"]

View file

@ -53,7 +53,7 @@ impl User {
role,
};
u.insert().await.unwrap();
u.insert().await.ok()?;
Some(u)
}

View file

@ -5,6 +5,7 @@ mod route;
use rocket::routes;
use rocket::{http::Method, launch};
use library::user::{User, UserRole};
#[launch]
async fn rocket() -> _ {
@ -25,6 +26,8 @@ async fn rocket() -> _ {
lib.rescan().await;
User::create("admin", "admin", UserRole::Admin).await;
rocket::build()
.mount(
"/",
@ -35,7 +38,8 @@ async fn rocket() -> _ {
route::album::album_route,
route::track::track_route,
route::track::track_audio_route,
route::album::album_cover_route
route::album::album_cover_route,
route::user::login_route
],
)
.manage(lib)