mirror of
https://github.com/spikecodes/libreddit
synced 2024-12-22 08:40:00 +01:00
Added multi-staged container build and a user (#134)
* Added multi-staged container build and a user This reduces the image size from 2Gb to 92Mb by only put the necessary files into the container. Container now runs without root priviliges. * Add EXPOSE to Dockerfile
This commit is contained in:
parent
47d01a0dca
commit
2b2bd8421b
13
Dockerfile
13
Dockerfile
@ -1,8 +1,17 @@
|
|||||||
FROM rust:latest
|
FROM rust:latest as builder
|
||||||
|
|
||||||
WORKDIR /usr/src/libreddit
|
WORKDIR /usr/src/libreddit
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN cargo install --path .
|
RUN cargo install --path .
|
||||||
|
|
||||||
|
|
||||||
|
FROM debian:buster-slim
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y libcurl4 && rm -rf /var/lib/apt/lists/*
|
||||||
|
COPY --from=builder /usr/local/cargo/bin/libreddit /usr/local/bin/libreddit
|
||||||
|
RUN useradd --system --user-group --home-dir /nonexistent --no-create-home --shell /usr/sbin/nologin libreddit
|
||||||
|
USER libreddit
|
||||||
|
|
||||||
|
EXPOSE 8080
|
||||||
|
|
||||||
CMD ["libreddit"]
|
CMD ["libreddit"]
|
||||||
|
Loading…
Reference in New Issue
Block a user