Skip to content
This repository was archived by the owner on Jun 19, 2025. It is now read-only.

Commit 3fd8049

Browse files
authored
Merge pull request #3160 from lissyx/circleci
Fix #3157: Add CircleCI config
2 parents 7580492 + c31c484 commit 3fd8049

File tree

4 files changed

+95
-34
lines changed

4 files changed

+95
-34
lines changed

.circleci/config.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# These environment variables must be set in CircleCI UI
2+
#
3+
# DOCKERHUB_REPO - docker hub repo, format: <username>/<repo>
4+
# DOCKER_USER - login info for docker hub
5+
# DOCKER_PASS
6+
#
7+
version: 2
8+
jobs:
9+
build:
10+
docker:
11+
- image: docker:stable-git
12+
working_directory: /dockerflow
13+
steps:
14+
- checkout
15+
- setup_remote_docker
16+
17+
- run:
18+
name: os-release
19+
command: |
20+
cat /etc/os-release
21+
22+
- run:
23+
name: install make
24+
command: |
25+
apk add make
26+
27+
- run:
28+
name: Create a Dockerfile.train
29+
command: |
30+
make Dockerfile.train \
31+
DEEPSPEECH_REPO="https://github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME" \
32+
DEEPSPEECH_SHA=$CIRCLE_SHA1
33+
34+
- run:
35+
name: Build Docker image
36+
command: docker build -t app:build -f Dockerfile.train .
37+
38+
# save the built docker container into CircleCI's cache. This is
39+
# required since Workflows do not have the same remote docker instance.
40+
- run:
41+
name: docker save app:build
42+
command: mkdir -p /cache; docker save -o /cache/docker.tar "app:build"
43+
- save_cache:
44+
key: v1-{{ .Branch }}-{{epoch}}
45+
paths:
46+
- /cache/docker.tar
47+
48+
deploy:
49+
docker:
50+
- image: docker:18.02.0-ce
51+
steps:
52+
- setup_remote_docker
53+
- restore_cache:
54+
key: v1-{{.Branch}}
55+
- run:
56+
name: Restore Docker image cache
57+
command: docker load -i /cache/docker.tar
58+
59+
- run:
60+
name: Deploy to Dockerhub
61+
command: |
62+
echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin
63+
# deploy master
64+
if [ "${CIRCLE_BRANCH}" == "master" ]; then
65+
docker tag app:build ${DOCKERHUB_REPO}:latest
66+
docker push ${DOCKERHUB_REPO}:latest
67+
elif [ ! -z "${CIRCLE_TAG}" ]; then
68+
# deploy a release tag...
69+
echo "${DOCKERHUB_REPO}:${CIRCLE_TAG}"
70+
docker tag app:build "${DOCKERHUB_REPO}:${CIRCLE_TAG}"
71+
docker images
72+
docker push "${DOCKERHUB_REPO}:${CIRCLE_TAG}"
73+
fi
74+
75+
workflows:
76+
version: 2
77+
build-deploy:
78+
jobs:
79+
- build:
80+
filters:
81+
tags:
82+
only: /.*/
83+
84+
- deploy:
85+
requires:
86+
- build
87+
filters:
88+
tags:
89+
only: /.*/

Dockerfile.build.tmpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1
4949
RUN curl -LO "https://github.com/bazelbuild/bazel/releases/download/2.0.0/bazel_2.0.0-linux-x86_64.deb"
5050
RUN dpkg -i bazel_*.deb
5151

52+
# Try and free some space
53+
RUN rm -rf /var/lib/apt/lists/*
54+
5255
# << END Install base software
5356

5457
# >> START Configure Tensorflow Build

Dockerfile.train.tmpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ RUN apt-get purge -y python3-xdg
2828
# Install dependencies for audio augmentation
2929
RUN apt-get install -y --no-install-recommends libopus0 libsndfile1
3030

31+
# Try and free some space
32+
RUN rm -rf /var/lib/apt/lists/*
33+
3134
WORKDIR /
3235
RUN git lfs install
3336
RUN git clone $DEEPSPEECH_REPO

hooks/pre_build

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

0 commit comments

Comments
 (0)