-
Notifications
You must be signed in to change notification settings - Fork 2
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
2 changed files
with
45 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,38 @@ | ||
# Dockerfile to build the executable binary. | ||
# The executable is placed in /mc-crawler. | ||
# The config is copied from the builder stage (and thus verbose from the sources). | ||
|
||
# Get some small base image to run things on. | ||
FROM debian:bullseye-slim AS runtime | ||
|
||
# Create a system user to drop into. | ||
# This will get some small (<1000) UID and GID, which is fine since we don't write to any files. | ||
RUN groupadd -r mccrawler \ | ||
&& useradd --no-log-init -r -g mccrawler mccrawler \ | ||
&& mkdir -p mc-crawler | ||
|
||
# Install OS dependencies. | ||
RUN apt-get update && apt-get install -y \ | ||
libssl-dev \ | ||
build-essential #libc | ||
|
||
# cd to working dir | ||
WORKDIR mc-crawler | ||
|
||
# Copy compiled binaries from builder | ||
COPY --from=mc-crawler-builder /mc-crawler/target/release/mc-crawler . | ||
# Copy required file with bootstrap peers from builder | ||
COPY --from=mc-crawler-builder /mc-crawler/bootstrap.txt . | ||
|
||
# Set ownership. | ||
RUN chown -R mccrawler:mccrawler ./mc-crawler | ||
|
||
# Set SGX environment variables needed by mobilecoin libraries | ||
ENV IAS_MODE=DEV \ | ||
SGX_MODE=SW | ||
|
||
# Drop root. | ||
USER mccrawler | ||
|
||
# Run the binary. | ||
ENTRYPOINT ["./mc-crawler","--output","crawl_data", "-c"] |
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,7 @@ | ||
#!/bin/bash | ||
# This script builds two docker images in a multi-stage build, i.e. | ||
# 1. mc-crawler-builder - this produces an image with the compiled crawler | ||
# 2. mc-crawler - the crawler is copied from the above image into a minimal runtime environment so as to keep the image size as small as possible | ||
|
||
docker build -t mc-crawler-builder -f Dockerfile.builder . | ||
docker build -t mc-crawler -f Dockerfile.crawler . |