Merge pull request #2 from williamdes/main

Some refreshments
This commit is contained in:
Víctor Martínez 2024-11-18 10:05:03 +01:00 committed by GitHub
commit 45fd087ad2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 623 additions and 426 deletions

3
.dockerignore Normal file
View file

@ -0,0 +1,3 @@
*
!src
!Cargo.*

1017
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -8,11 +8,11 @@ edition = "2018"
[dependencies]
actix = "0.10.0"
actix-web = "3"
actix-web = "3.3.3"
actix-web-actors = "3.0.0"
uuid = { version = "0.8", features = ["serde", "v4"] }
derive_more = "0.99.11"
uuid = { version = "1.10.0", features = ["serde", "v4"] }
derive_more = { version = "1.0.0", features = ["full"] }
serde_json = "1.0.64"
serde = "1.0.124"
env_logger = "0.8.3"
env_logger = "0.11.5"
rand = "0.8.3"

View file

@ -1,4 +1,4 @@
FROM rust:1.50.0 as build
FROM rust:1.78.0 as build
WORKDIR /app
COPY . .
@ -6,8 +6,12 @@ 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
# Ubuntu 24.10
FROM ubuntu:24.10 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/* /
COPY --from=build /build-out/actix-messaging /usr/local/bin/actix-messaging
ENV PORT=8080
ENTRYPOINT [ "/usr/local/bin/actix-messaging" ]

View file

@ -14,6 +14,13 @@ cargo build
cargo run
```
## Test with docker
```sh
docker build ./ -t actix-chat
docker run --rm -p 8080:8080 actix-chat
```
## How to interact with the app
### Connect

View file

@ -12,7 +12,7 @@ pub enum Command {
}
#[derive(Debug, Display, Error)]
#[display(fmt = "Invalid command: {}", msg)]
#[display("Invalid command: {}", msg)]
pub struct CommandError {
msg: &'static str,
}