update
This commit is contained in:
parent
1e67f223f7
commit
0bdf75446d
4 changed files with 58 additions and 2 deletions
35
.forgejo/workflows/deploy.yml
Normal file
35
.forgejo/workflows/deploy.yml
Normal 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
17
Dockerfile
Normal 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"]
|
|
@ -53,7 +53,7 @@ impl User {
|
||||||
role,
|
role,
|
||||||
};
|
};
|
||||||
|
|
||||||
u.insert().await.unwrap();
|
u.insert().await.ok()?;
|
||||||
|
|
||||||
Some(u)
|
Some(u)
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ mod route;
|
||||||
|
|
||||||
use rocket::routes;
|
use rocket::routes;
|
||||||
use rocket::{http::Method, launch};
|
use rocket::{http::Method, launch};
|
||||||
|
use library::user::{User, UserRole};
|
||||||
|
|
||||||
#[launch]
|
#[launch]
|
||||||
async fn rocket() -> _ {
|
async fn rocket() -> _ {
|
||||||
|
@ -25,6 +26,8 @@ async fn rocket() -> _ {
|
||||||
|
|
||||||
lib.rescan().await;
|
lib.rescan().await;
|
||||||
|
|
||||||
|
User::create("admin", "admin", UserRole::Admin).await;
|
||||||
|
|
||||||
rocket::build()
|
rocket::build()
|
||||||
.mount(
|
.mount(
|
||||||
"/",
|
"/",
|
||||||
|
@ -35,7 +38,8 @@ async fn rocket() -> _ {
|
||||||
route::album::album_route,
|
route::album::album_route,
|
||||||
route::track::track_route,
|
route::track::track_route,
|
||||||
route::track::track_audio_route,
|
route::track::track_audio_route,
|
||||||
route::album::album_cover_route
|
route::album::album_cover_route,
|
||||||
|
route::user::login_route
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
.manage(lib)
|
.manage(lib)
|
||||||
|
|
Loading…
Reference in a new issue