Skip to content

Commit b068a1e

Browse files
authored
ci(Circle): Builds docker images on branches (#688)
1 parent 8ff34c4 commit b068a1e

File tree

2 files changed

+47
-4
lines changed

2 files changed

+47
-4
lines changed

.circleci/config.yml

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,12 @@ jobs:
1919
working_directory: ~/repo
2020
steps:
2121
- checkout
22-
- setup_remote_docker:
23-
docker_layer_caching: true
2422
- restore_cache:
2523
keys:
2624
- v1-dependencies-{{ checksum "yarn.lock" }}
2725
- run:
2826
name: Installing Dependencies
29-
command: yarn install --ignore-engines
27+
command: yarn install --ignore-engines --frozen-lockfile
3028
- save_cache:
3129
paths:
3230
- node_modules
@@ -43,6 +41,28 @@ jobs:
4341
- run:
4442
name: Conformance Tests
4543
command: sh test.sh
44+
- save_cache:
45+
paths:
46+
- dist
47+
key: dist-{{ .Branch }}-{{ .Revision }}
48+
release:
49+
docker:
50+
- image: node:10
51+
environment:
52+
- DOCKER_REPO_SLUG: learninglocker/xapi-service
53+
- DOCKER_USERNAME: ryansmith94
54+
- DOCKER_EMAIL: [email protected]
55+
working_directory: ~/repo
56+
steps:
57+
- checkout
58+
- setup_remote_docker:
59+
docker_layer_caching: true
60+
- restore_cache:
61+
keys:
62+
- v1-dependencies-{{ checksum "yarn.lock" }}
63+
- restore_cache:
64+
keys:
65+
- dist-{{ .Branch }}-{{ .Revision }}
4666
- run:
4767
name: Docker Install
4868
command: |
@@ -54,6 +74,29 @@ jobs:
5474
- run:
5575
name: Docker Build
5676
command: docker build -t "$DOCKER_REPO_SLUG" .
77+
- run:
78+
name: Docker Tag
79+
command: docker tag $DOCKER_REPO_SLUG $DOCKER_REPO_SLUG:$CIRCLE_BRANCH
5780
- deploy:
5881
name: Semantic Release
5982
command: yarn semantic-release
83+
- run:
84+
name: Docker Login
85+
command: docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
86+
- run:
87+
name: Docker Push
88+
command: docker push $DOCKER_REPO_SLUG:$CIRCLE_BRANCH
89+
90+
workflows:
91+
version: 2
92+
build:
93+
jobs:
94+
- build
95+
- release:
96+
requires:
97+
- build
98+
filters:
99+
branches:
100+
ignore:
101+
- /^dependabot\/.*/
102+
- /^renovate\/.*/

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ WORKDIR /usr/src/app
44

55
COPY package.json package.json
66
COPY yarn.lock yarn.lock
7-
RUN yarn install --production --ignore-engines
7+
RUN yarn install --production --ignore-engines --frozen-lockfile
88
COPY dist dist
99

1010
EXPOSE 80

0 commit comments

Comments
 (0)