Slight restructure, Containerfile now does npm build properly
This commit is contained in:
parent
3bc6e6928e
commit
e5dfc47ccf
8 changed files with 52 additions and 33 deletions
|
@ -1 +0,0 @@
|
|||
target
|
|
@ -1,26 +0,0 @@
|
|||
# The rust:latest-alpine uses musl libc
|
||||
FROM docker.io/rust:latest as builder
|
||||
WORKDIR /build
|
||||
ADD . /build
|
||||
RUN apt update
|
||||
RUN apt install musl musl-dev musl-tools -y
|
||||
RUN rustup target add x86_64-unknown-linux-musl
|
||||
RUN cargo build --target x86_64-unknown-linux-musl --release
|
||||
|
||||
FROM docker.io/alpine:latest as runner
|
||||
|
||||
# Add a non-root user for running the server
|
||||
RUN addgroup -S user && adduser -S user -G user
|
||||
|
||||
# Copy the server binary and the public directory
|
||||
WORKDIR /runner
|
||||
COPY --from=builder /build/target/x86_64-unknown-linux-musl/release/server /runner/server
|
||||
COPY --from=builder /build/public /runner/public
|
||||
|
||||
# Make sure the user can access the files
|
||||
RUN chown -R user:user /runner
|
||||
USER user
|
||||
|
||||
# Run the server
|
||||
EXPOSE 8080
|
||||
CMD ["./server"]
|
Loading…
Add table
Add a link
Reference in a new issue