-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |