Skip to content
This repository was archived by the owner on Mar 23, 2021. It is now read-only.

Commit 2392d07

Browse files
Build docker image from existing release binary upon release
1 parent 420c7fd commit 2392d07

File tree

5 files changed

+29
-45
lines changed

5 files changed

+29
-45
lines changed

.circleci/config.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,9 @@ jobs:
9393
- install_rust
9494
- install_node_devlibs
9595
- print_current_versions
96+
- setup_remote_docker
9697
- run:
97-
name: "Package & Publish Release on GitHub"
98+
name: "Package & Publish Release on GitHub and Docker Hub"
9899
command: |
99100
set -v
100101
VERSION=$(cargo pkgid -- cnd|cut -d# -f2)
@@ -108,6 +109,12 @@ jobs:
108109
ls ~/package/
109110
ghr -t ${GITHUB_TOKEN_FOR_RELEASES} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${VERSION} ~/package/
110111
112+
echo $DOCKER_HUB_TOKEN | docker login -u thomaseizinger --password-stdin
113+
114+
docker build . -t comitnetwork/cnd:${VERSION} -t comitnetwork/cnd:latest
115+
docker push comitnetwork/cnd:${VERSION}
116+
docker push comitnetwork/cnd:latest
117+
111118
commands:
112119
install_node_devlibs:
113120
steps:

.docker/Dockerfile

Lines changed: 0 additions & 34 deletions
This file was deleted.

.docker/README.md

Lines changed: 0 additions & 4 deletions
This file was deleted.

.dockerignore

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
target/
2-
.circleci/
3-
.dependabot/
4-
.githooks/
5-
api_tests/
6-
.docker/Dockerfile
1+
# The only thing we are interested in the Dockerfile is the release binary, hence we can ignore everything else to speed up the build process
2+
*
3+
!target/release/cnd

Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM debian:buster
2+
3+
RUN apt-get update && \
4+
apt-get install -y \
5+
tini \
6+
&& rm -rf /var/lib/apt/lists/*
7+
8+
RUN useradd --create-home --shell /bin/bash cnd
9+
USER cnd
10+
11+
COPY ./target/release/cnd /usr/local/bin
12+
13+
EXPOSE 9939
14+
EXPOSE 8000
15+
16+
# tini allows us to CTRL+C our container if it runs in the foreground
17+
ENTRYPOINT ["tini"]
18+
CMD ["cnd"]

0 commit comments

Comments
 (0)