FIX: re implement docker file
Some checks failed
Deploy API / build-and-deploy (push) Failing after 2m39s
Some checks failed
Deploy API / build-and-deploy (push) Failing after 2m39s
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,3 +1,5 @@
|
||||
/target
|
||||
/.vscode
|
||||
|
||||
|
||||
.env
|
||||
23
Dockerfile
Normal file
23
Dockerfile
Normal file
@@ -0,0 +1,23 @@
|
||||
FROM rust:latest AS builder
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
RUN cargo build --release
|
||||
|
||||
FROM debian:bookworm-slim
|
||||
|
||||
# Create the app user with UID 1001
|
||||
RUN useradd -u 1001 -m appuser
|
||||
|
||||
# Create working directory (only needed if your app expects /app)
|
||||
WORKDIR /app
|
||||
|
||||
# Copy binary from builder
|
||||
COPY --from=builder /app/target/release/hotel-api-rs /usr/local/bin/hotel-api-rs
|
||||
|
||||
# Switch to non-root user
|
||||
USER 1001
|
||||
|
||||
# Expose API port
|
||||
EXPOSE 8080
|
||||
|
||||
CMD ["/usr/local/bin/hotel-api-rs"]
|
||||
@@ -3,7 +3,6 @@ use axum::{
|
||||
extract::{FromRequest, Request},
|
||||
http::StatusCode,
|
||||
};
|
||||
use chrono::NaiveDateTime;
|
||||
use serde::Deserialize;
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
|
||||
@@ -208,7 +208,7 @@ pub struct Get
|
||||
pub async fn get_conv_users(
|
||||
State(state): State<AppState>,
|
||||
AuthClaims { user_id, hotel_id }: AuthClaims,
|
||||
Path(conv_id): Path<(i32)>,
|
||||
Path(conv_id): Path<i32>,
|
||||
) -> impl IntoResponse {
|
||||
let pool = state.hotel_pools.get_pool(hotel_id);
|
||||
|
||||
|
||||
25
src/main.rs
25
src/main.rs
@@ -4,25 +4,14 @@ use axum::extract::{
|
||||
ws::{Message, WebSocket, WebSocketUpgrade},
|
||||
};
|
||||
use axum::serve;
|
||||
|
||||
use jsonwebtoken::{DecodingKey, EncodingKey};
|
||||
use reqwest::header::AUTHORIZATION;
|
||||
use reqwest::header::CONTENT_TYPE;
|
||||
use reqwest::header::USER_AGENT;
|
||||
|
||||
|
||||
use tokio::net::TcpListener;
|
||||
|
||||
|
||||
|
||||
mod chat;
|
||||
mod inventory;
|
||||
mod rooms;
|
||||
mod routes;
|
||||
mod utils;
|
||||
use dashmap::DashMap;
|
||||
use r2d2::Pool;
|
||||
use r2d2_sqlite::SqliteConnectionManager;
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::utils::auth::JwtKeys;
|
||||
use crate::utils::db_pool::{AppState, HotelPool};
|
||||
use routes::create_router;
|
||||
@@ -33,6 +22,16 @@ use std::env;
|
||||
use axum::http::{HeaderValue, Method};
|
||||
use tower_http::cors::{Any, CorsLayer};
|
||||
|
||||
mod chat;
|
||||
mod inventory;
|
||||
mod rooms;
|
||||
mod routes;
|
||||
mod utils;
|
||||
use dashmap::DashMap;
|
||||
use r2d2::Pool;
|
||||
use r2d2_sqlite::SqliteConnectionManager;
|
||||
use std::sync::Arc;
|
||||
|
||||
pub async fn notify_discord(msg: &str) -> Result<(), reqwest::Error> {
|
||||
let payload = serde_json::json!({
|
||||
"content": msg
|
||||
|
||||
Reference in New Issue
Block a user