Skip to content

Commit

Permalink
Add Mithril Client Dockerfile #102
Browse files Browse the repository at this point in the history
  • Loading branch information
jpraynaud committed Apr 14, 2022
1 parent 2493649 commit bfb7cb4
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions mithril-network/mithril-client/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
###############################
# STEP 1: build rust executable
###############################
FROM rust:alpine AS rustbuilder

# Upgrade and install build base
RUN apk update && apk add build-base && apk add pkgconfig && apk add openssl-dev

# Create appuser
RUN adduser -D -g '' appuser

# Copy files
WORKDIR /app
COPY . .

# Build the binary
WORKDIR /app/mithril-network/mithril-client/
RUN make build

###############################
# STEP 2: build a small image
###############################
FROM alpine:latest

# Upgrade
RUN apk update

# Import the user and group files from the builder
COPY --from=rustbuilder /etc/passwd /etc/passwd

# Copy the executable
COPY --from=rustbuilder /app/mithril-network/mithril-client/target/release/mithril-client /app/bin/mithril-client

# Copy the config files
COPY --from=rustbuilder /app/mithril-network/mithril-client/config /app/config

#Workdir
WORKDIR /app/

# Use an unprivileged user
USER appuser

# Run the executable
ENTRYPOINT ["/app/bin/mithril-client"]

0 comments on commit bfb7cb4

Please sign in to comment.