mirror of
https://github.com/nicoburns/blessed-rs
synced 2024-11-13 23:47:07 +00:00
Build inside docker container
This commit is contained in:
parent
165e474114
commit
f5ea799eee
3 changed files with 31 additions and 31 deletions
24
Dockerfile
24
Dockerfile
|
@ -1,13 +1,25 @@
|
||||||
FROM debian:buster-slim
|
# Build image
|
||||||
EXPOSE 3333
|
FROM rust:1.65 as builder
|
||||||
|
|
||||||
COPY target/release/blessed-rs /usr/local/bin/blessed-rs
|
# Run dummy build to build and cache dependencies that only depends on Cargo.toml and Cargo.lock
|
||||||
RUN chmod +x /usr/local/bin/blessed-rs
|
WORKDIR /usr/src
|
||||||
|
RUN USER=root cargo new blessed-rs
|
||||||
|
COPY Cargo.toml Cargo.lock /usr/src/blessed-rs/
|
||||||
|
WORKDIR /usr/src/blessed-rs
|
||||||
|
RUN cargo build --release
|
||||||
|
|
||||||
|
# Run actual build
|
||||||
|
COPY ./src ./src
|
||||||
|
COPY ./data ./data
|
||||||
|
RUN cargo build --release
|
||||||
|
|
||||||
|
# Run image
|
||||||
|
FROM debian:buster-slim
|
||||||
|
# RUN apt-get update && apt-get install -y extra-runtime-dependencies && rm -rf /var/lib/apt/lists/*
|
||||||
|
COPY --from=builder /usr/src/blessed-rs/target/release/blessed-rs /usr/local/bin/blessed-rs
|
||||||
|
|
||||||
WORKDIR /usr/blessed-rs
|
WORKDIR /usr/blessed-rs
|
||||||
COPY ./static ./static
|
COPY ./static ./static
|
||||||
COPY ./templates ./templates
|
COPY ./templates ./templates
|
||||||
COPY ./data ./data
|
COPY ./data ./data
|
||||||
|
|
||||||
|
|
||||||
CMD ["blessed-rs"]
|
CMD ["blessed-rs"]
|
|
@ -1,25 +0,0 @@
|
||||||
# Build image
|
|
||||||
FROM rust:1.60 as builder
|
|
||||||
|
|
||||||
# Run dummy build to build and cache dependencies that only depends on Cargo.toml and Cargo.lock
|
|
||||||
WORKDIR /usr/src
|
|
||||||
RUN USER=root cargo new blessed-rs
|
|
||||||
COPY Cargo.toml Cargo.lock /usr/src/blessed-rs/
|
|
||||||
WORKDIR /usr/src/blessed-rs
|
|
||||||
RUN cargo build --release
|
|
||||||
|
|
||||||
# Run actual build
|
|
||||||
COPY ./src ./src
|
|
||||||
COPY ./data ./data
|
|
||||||
RUN cargo build --release
|
|
||||||
|
|
||||||
# Run image
|
|
||||||
FROM debian:buster-slim
|
|
||||||
# RUN apt-get update && apt-get install -y extra-runtime-dependencies && rm -rf /var/lib/apt/lists/*
|
|
||||||
COPY --from=builder /usr/src/blessed-rs/target/release/blessed-rs /usr/local/bin/blessed-rs
|
|
||||||
|
|
||||||
WORKDIR /usr/blessed-rs
|
|
||||||
COPY ./static ./static
|
|
||||||
COPY ./templates ./templates
|
|
||||||
COPY ./data ./data
|
|
||||||
CMD ["blessed-rs"]
|
|
13
Dockerfile.simple
Normal file
13
Dockerfile.simple
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
FROM debian:buster-slim
|
||||||
|
EXPOSE 3333
|
||||||
|
|
||||||
|
COPY target/release/blessed-rs /usr/local/bin/blessed-rs
|
||||||
|
RUN chmod +x /usr/local/bin/blessed-rs
|
||||||
|
|
||||||
|
WORKDIR /usr/blessed-rs
|
||||||
|
COPY ./static ./static
|
||||||
|
COPY ./templates ./templates
|
||||||
|
COPY ./data ./data
|
||||||
|
|
||||||
|
|
||||||
|
CMD ["blessed-rs"]
|
Loading…
Reference in a new issue