Skip to content

Commit

Permalink
feat: add Dockerfile
Browse files Browse the repository at this point in the history
Signed-off-by: Frank Yang <[email protected]>
  • Loading branch information
FrankYang0529 committed Sep 30, 2022
1 parent 9169642 commit 3c9d5ae
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM rust:1.61 as builder

WORKDIR /app
COPY . /app
RUN cargo build --release --all-features --bin bindle-server

FROM rust:1.61-slim-buster

ARG USERNAME=bindle
ARG USER_UID=1000
ARG USER_GID=$USER_UID

VOLUME [ "/bindle-data" ]

ENV BINDLE_IP_ADDRESS_PORT="0.0.0.0:8080"
ENV BINDLE_DIRECTORY="/bindle-data/bindles"

RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME

COPY --from=builder --chown=$USERNAME /app/target/release/bindle-server /usr/local/bin/bindle-server

USER $USERNAME
CMD ["/usr/local/bin/bindle-server", "--unauthenticated", "--keyring", "/bindle-data/keyring.toml"]
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,7 @@ build-client:

$(CERT_NAME).crt.pem:
openssl req -newkey rsa:2048 -nodes -keyout $(CERT_NAME).key.pem -x509 -days 365 -out $(CERT_NAME).crt.pem

.PHONY: build-docker-image
build-docker-image:
docker build -t deislabs/bindle:dev .

0 comments on commit 3c9d5ae

Please sign in to comment.