Skip to content
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

feat: dockerfile for hub #48

Merged
merged 1 commit into from
Dec 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**/*.rs
target/
!target/release/ckb
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ security-audit:
@cargo audit --version || cargo install cargo-audit
@cargo audit

.PHONY: build build-integration-test
docker: build
docker build -f docker/hub/Dockerfile -t ckb:latest .

.PHONY: build build-integration-test docker
.PHONY: fmt test clippy proto doc doc-deps check stats
.PHONY: ci ci-quick info security-audit
37 changes: 37 additions & 0 deletions docker/hub/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
FROM ubuntu:bionic
LABEL description="Nervos CKB is a public permissionless blockchain, the common knowledge layer of Nervos network."
LABEL maintainer="Nervos Core Dev <[email protected]>"

#build arg
ARG DATADIR=/usr/local/share/ckb
ENV DATADIR ${DATADIR}

#useradd
RUN groupadd -g 1000 ckb && useradd -m -u 1000 -g ckb -s /bin/sh ckb

WORKDIR ${DATADIR}

#apt
RUN apt update && apt install -y --no-install-recommends openssl1.0 libssl1.0

#cleanup
RUN apt autoremove -y
RUN apt clean -y
RUN rm -rf /tmp/* /var/tmp/* /var/lib/apt/lists/*

#target
COPY target/release/ckb /bin/ckb

#entrypoint
RUN echo "#!/bin/bash \n ckb \$@" > ./entrypoint.sh
RUN chmod +x ./entrypoint.sh

# copy "nodes_template" to `WORKDIR`/nodes/
COPY nodes_template/ nodes/
RUN chown -R ckb:ckb $DATADIR/nodes

#switch use
USER ckb

EXPOSE 8114/tcp 8115/udp
ENTRYPOINT ["./entrypoint.sh"]