Add Docker support (#1)

This commit is contained in:
Mylloon 2023-02-16 20:06:07 +01:00
parent 23f0c99540
commit e6438cee08
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
4 changed files with 35 additions and 1 deletions

2
.gitignore vendored
View file

@ -1,3 +1,5 @@
/target /target
/config /config
/dist /dist
docker-compose.yml

18
Dockerfile Normal file
View file

@ -0,0 +1,18 @@
# syntax=docker/dockerfile:1
FROM rust:1.67 AS builder
WORKDIR /usr/src/ewp
COPY . .
RUN cargo install --path .
FROM debian:bullseye-slim
RUN mkdir /app
WORKDIR /app
COPY --from=builder /usr/local/cargo/bin/ewp /app/ewp
COPY --from=builder /usr/src/ewp/LICENSE /app/LICENSE
COPY --from=builder /usr/src/ewp/static /app/static
CMD [ "./ewp" ]

View file

@ -5,3 +5,17 @@ Easy WebPage generator
[![dependency status](https://deps.rs/repo/gitea/git.mylloon.fr/Anri/mylloon.fr/status.svg)](https://deps.rs/repo/gitea/git.mylloon.fr/Anri/mylloon.fr) [![dependency status](https://deps.rs/repo/gitea/git.mylloon.fr/Anri/mylloon.fr/status.svg)](https://deps.rs/repo/gitea/git.mylloon.fr/Anri/mylloon.fr)
See [issues](https://git.mylloon.fr/Anri/mylloon.fr/issues) See [issues](https://git.mylloon.fr/Anri/mylloon.fr/issues)
## Use Docker Compose
```yaml
version: "3.9"
services:
ewp:
build: .
container_name: EWP
ports:
- 80:8080
restart: unless-stopped
```

View file

@ -30,7 +30,7 @@ mod portfolio;
async fn main() -> io::Result<()> { async fn main() -> io::Result<()> {
let config = config::get_config("./config/config.toml"); let config = config::get_config("./config/config.toml");
let addr = ("127.0.0.1", config.port.unwrap()); let addr = ("0.0.0.0", config.port.unwrap());
println!( println!(
"Listening to {}://{}:{}", "Listening to {}://{}:{}",