forked from spacebar/spfn-website
Add Backend
This commit is contained in:
parent
dc101e28f8
commit
05beab587b
31 changed files with 59 additions and 6 deletions
25
Dockerfile
25
Dockerfile
|
|
@ -1,13 +1,28 @@
|
|||
# syntax=docker/dockerfile:1
|
||||
|
||||
FROM nginx:alpine
|
||||
FROM rust:alpine AS builder
|
||||
|
||||
WORKDIR /usr/share/nginx/html
|
||||
RUN apk add --no-cache musl-dev openssl-dev openssl-libs-static protobuf-dev lld
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY Cargo.toml ./
|
||||
RUN mkdir src && echo "fn main() {}" > src/main.rs && cargo fetch
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN rm -rf .git
|
||||
ENV SQLX_OFFLINE=true
|
||||
|
||||
EXPOSE 80
|
||||
RUN OPENSSL_LIB_DIR=/usr/lib OPENSSL_INCLUDE_DIR=/usr/include/openssl OPENSSL_STATIC=1 RUSTFLAGS="-C target-feature=+aes,+sse -C relocation-model=static -C linker=ld.lld" cargo build --release --target x86_64-unknown-linux-musl
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
FROM alpine:latest AS final
|
||||
|
||||
RUN apk add --no-cache ca-certificates
|
||||
RUN update-ca-certificates
|
||||
|
||||
WORKDIR /
|
||||
|
||||
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/spfn-website /spfn-website
|
||||
COPY --from=builder /app/static /static
|
||||
|
||||
ENTRYPOINT ["/spfn-website"]
|
||||
|
|
|
|||
Loading…
Reference in a new issue