add Dockerfile
This commit is contained in:
56
Dockerfile
Normal file
56
Dockerfile
Normal file
@@ -0,0 +1,56 @@
|
||||
FROM docker.io/library/rust:1-alpine AS chef
|
||||
RUN apk add --no-cache musl-dev openssl-dev openssl-libs-static git pkgconf
|
||||
RUN cargo install cargo-chef
|
||||
RUN cargo install trunk
|
||||
RUN rustup target add wasm32-unknown-unknown
|
||||
WORKDIR /app
|
||||
|
||||
FROM chef AS planner-peazyrsa
|
||||
RUN git clone https://gitea.b4tman.ru/b4tman/peazyrsa -b v0.1.0 --depth 1 .
|
||||
RUN cargo chef prepare --recipe-path recipe.json
|
||||
|
||||
FROM chef AS builder-peazyrsa
|
||||
COPY --from=planner-peazyrsa /app/recipe.json recipe.json
|
||||
RUN cargo chef cook --release --recipe-path recipe.json
|
||||
RUN git clone https://gitea.b4tman.ru/b4tman/peazyrsa -b v0.1.0 --depth 1 peazyrsa
|
||||
RUN cp -af peazyrsa/* . && rm -rf peazyrsa
|
||||
RUN cargo build --release
|
||||
|
||||
FROM chef AS planner-peasyweb
|
||||
COPY . .
|
||||
RUN cargo chef prepare --recipe-path recipe.json
|
||||
|
||||
FROM chef AS builder-peasyweb
|
||||
COPY --from=planner-peasyweb /app/recipe.json recipe.json
|
||||
RUN cargo chef cook --release --recipe-path recipe.json
|
||||
COPY . .
|
||||
ENV API_BASE_URL="/api/v1"
|
||||
RUN cargo build -p peazyweb-backend --release
|
||||
WORKDIR /app/frontend
|
||||
RUN trunk build --release --public-url "/frontend"
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
FROM docker.io/library/alpine:3.21 AS runtime
|
||||
RUN apk add --no-cache openssl libssl3 libcrypto3
|
||||
RUN mkdir -p /app/frontend
|
||||
RUN mkdir /data
|
||||
WORKDIR /app
|
||||
COPY --from=builder-peazyrsa /app/target/release/peazyrsa /usr/local/bin/peazyrsa
|
||||
COPY --from=builder-peasyweb /app/target/release/peazyweb-backend /usr/local/bin/peazyweb-backend
|
||||
COPY --from=builder-peasyweb /app/frontend/dist/ /app/frontend
|
||||
|
||||
VOLUME [ "/data" ]
|
||||
|
||||
ENV GENERATION_BASE_DIRECTORY="/data"
|
||||
ENV GENERATION_BIN="/usr/local/bin/peazyrsa"
|
||||
ENV USE_OPENSSL="yes"
|
||||
ENV OPENSSL_BIN="/usr/bin/openssl"
|
||||
ENV FRONTEND_BASE="/app/frontend"
|
||||
|
||||
ENV ROCKET_ADDRESS="0.0.0.0"
|
||||
ENV ROCKET_PORT=80
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/peazyweb-backend"]
|
Reference in New Issue
Block a user