-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: rvalle/feature docker #437
Open
rvalle
wants to merge
2
commits into
paritytech:master
Choose a base branch
from
Polkawatch:rvalle/feature-docker
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,36 @@ | ||
FROM docker.io/paritytech/ci-linux:production as builder | ||
LABEL description="build stage for Substrate Archive. We are creating the binary." | ||
|
||
ARG PROFILE=release | ||
WORKDIR /substrate-archive | ||
|
||
COPY . /substrate-archive | ||
|
||
RUN cargo build --$PROFILE --bin polkadot-archive | ||
RUN ls | ||
|
||
# ===== SECOND STAGE ====== | ||
|
||
FROM docker.io/library/debian:buster | ||
LABEL description="This is the 2nd stage: a very small image where we copy the Polkadot binary." | ||
ARG PROFILE=release | ||
RUN ls | ||
COPY --from=builder /substrate-archive/target/$PROFILE/polkadot-archive /usr/local/bin | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y libssl1.1 && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
RUN useradd -m -u 1000 -U -s /bin/sh -d /polkadot-archive polkadot-archive && \ | ||
mkdir -p /polkadot-archive/.local/share && \ | ||
mkdir /data && \ | ||
chown -R polkadot-archive:polkadot-archive /data && \ | ||
ln -s /data /polkadot-archive/.local/share/polkadot-archive && \ | ||
rm -rf /usr/bin /usr/sbin | ||
|
||
USER polkadot-archive | ||
VOLUME ["/data"] | ||
|
||
CMD ["/usr/local/bin/polkadot-archive"] | ||
|
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,26 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
pushd . | ||
|
||
# The following line ensure we run from the project root | ||
PROJECT_ROOT=`git rev-parse --show-toplevel` | ||
cd $PROJECT_ROOT | ||
|
||
# Find the current version from Cargo.toml | ||
VERSION=`grep "^version" ./Cargo.toml | egrep -o "([0-9\.]+)"` | ||
GITUSER=parity | ||
GITREPO=substrate-archive | ||
|
||
# Build the image | ||
echo "Building ${GITUSER}/${GITREPO}:latest docker image, hang on!" | ||
time docker build -f ./docker/Dockerfile --build-arg RUSTC_WRAPPER= --build-arg PROFILE=release -t ${GITUSER}/${GITREPO}:latest . | ||
|
||
# Show the list of available images for this repo | ||
echo "Image is ready" | ||
docker images | grep ${GITREPO} | ||
|
||
echo -e "\nIf you just built version ${VERSION}, you may want to update your tag:" | ||
echo " $ docker tag ${GITUSER}/${GITREPO}:$VERSION ${GITUSER}/${GITREPO}:${VERSION}" | ||
|
||
popd |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if it's just me, but I have to change this to
/bin/polkadot-archive/Cargo.toml
to work -- there's no version in the rootCargo.toml
since it's a workspace,There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point. Yes, I noticed it failing to collect any version.