mirror of
https://codeberg.org/JasterV/chat-rooms-actix.git
synced 2026-04-26 18:10:04 +00:00
dockerfile & heroku added
This commit is contained in:
parent
4e0ca5821e
commit
943c0f3391
3 changed files with 23 additions and 1 deletions
15
Dockerfile
Normal file
15
Dockerfile
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
FROM rust:1.50.0 as build
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
COPY . .
|
||||||
|
RUN cargo build --release
|
||||||
|
RUN mkdir -p /build-out
|
||||||
|
RUN cp target/release/actix-messaging /build-out/
|
||||||
|
|
||||||
|
# Ubuntu 18.04
|
||||||
|
FROM ubuntu:18.04 as production
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get -y install ca-certificates libssl-dev && rm -rf /var/lib/apt/lists/*
|
||||||
|
COPY --from=build /build-out/* /
|
||||||
|
|
||||||
|
CMD [ "./actix-messaging" ]
|
||||||
3
heroku.yml
Normal file
3
heroku.yml
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
build:
|
||||||
|
docker:
|
||||||
|
app: Dockerfile
|
||||||
|
|
@ -11,13 +11,17 @@ use routes::connect;
|
||||||
|
|
||||||
#[actix_web::main]
|
#[actix_web::main]
|
||||||
async fn main() -> std::io::Result<()> {
|
async fn main() -> std::io::Result<()> {
|
||||||
|
|
||||||
|
let port = std::env::var("PORT").expect("PORT env variable not found");
|
||||||
|
let addr = format!("127.0.0.1:{}", port);
|
||||||
|
|
||||||
let chat = ChatServer::new().start();
|
let chat = ChatServer::new().start();
|
||||||
HttpServer::new(move || {
|
HttpServer::new(move || {
|
||||||
App::new()
|
App::new()
|
||||||
.data(AppState { chat: chat.clone() })
|
.data(AppState { chat: chat.clone() })
|
||||||
.service(connect)
|
.service(connect)
|
||||||
})
|
})
|
||||||
.bind("127.0.0.1:8080")?
|
.bind(&addr)?
|
||||||
.run()
|
.run()
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue