docker
This commit is contained in:
parent
a85c1431c8
commit
44793eb8d4
3 changed files with 59 additions and 0 deletions
13
.dockerignore
Normal file
13
.dockerignore
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
# Docker
|
||||||
|
Dockerfile
|
||||||
|
.dockerignore
|
||||||
|
|
||||||
|
# ide and os
|
||||||
|
.idea/
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# database
|
||||||
|
/database/
|
||||||
|
|
||||||
|
# rust
|
||||||
|
target/
|
||||||
30
Dockerfile
Normal file
30
Dockerfile
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
LABEL maintainer="Philippe Loctaux <p@philippeloctaux.com>"
|
||||||
|
|
||||||
|
FROM clux/muslrust:1.67.0-stable as chef
|
||||||
|
USER root
|
||||||
|
RUN cargo install cargo-chef
|
||||||
|
WORKDIR /ezidam
|
||||||
|
|
||||||
|
FROM chef AS planner
|
||||||
|
COPY Cargo.toml .
|
||||||
|
COPY Cargo.lock .
|
||||||
|
COPY crates crates
|
||||||
|
RUN cargo chef prepare --recipe-path recipe.json
|
||||||
|
|
||||||
|
FROM chef AS builder
|
||||||
|
COPY --from=planner /ezidam/recipe.json recipe.json
|
||||||
|
RUN cargo chef cook --release --target x86_64-unknown-linux-musl --recipe-path recipe.json
|
||||||
|
COPY --from=planner /ezidam/Cargo.toml .
|
||||||
|
COPY --from=planner /ezidam/Cargo.lock .
|
||||||
|
COPY --from=planner /ezidam/crates crates
|
||||||
|
COPY logo logo
|
||||||
|
RUN cargo build --release --target x86_64-unknown-linux-musl --package ezidam --bin ezidam
|
||||||
|
|
||||||
|
FROM scratch
|
||||||
|
COPY --from=builder /ezidam/target/x86_64-unknown-linux-musl/release/ezidam /ezidam
|
||||||
|
ENV ROCKET_CLI_COLORS=0
|
||||||
|
ENV ROCKET_ADDRESS=0.0.0.0
|
||||||
|
ENV ROCKET_PORT=8000
|
||||||
|
ENV ROCKET_DATABASES='{ezidam={url="/database/ezidam.sqlite"}}'
|
||||||
|
EXPOSE 8000
|
||||||
|
ENTRYPOINT ["/ezidam"]
|
||||||
16
justfile
Executable file
16
justfile
Executable file
|
|
@ -0,0 +1,16 @@
|
||||||
|
#!/usr/bin/env just --justfile
|
||||||
|
|
||||||
|
database_path := "/tmp/ezidam/docker"
|
||||||
|
|
||||||
|
# list recipes
|
||||||
|
default:
|
||||||
|
just --list
|
||||||
|
|
||||||
|
docker_build:
|
||||||
|
docker build --progress=plain --platform linux/amd64 -t ezidam .
|
||||||
|
|
||||||
|
docker_run:
|
||||||
|
mkdir -p {{database_path}}
|
||||||
|
docker run --rm -p 8000:8000 -v {{database_path}}:/database --platform linux/amd64 ezidam
|
||||||
|
|
||||||
|
docker_all: docker_build docker_run
|
||||||
Loading…
Add table
Add a link
Reference in a new issue