Skip to content

Commit

Permalink
feat: dockerfile for hub (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangsoledad authored and doitian committed Dec 4, 2018
1 parent 4c9b397 commit f93e1da
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
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"]

0 comments on commit f93e1da

Please sign in to comment.