Skip to content

Commit cf3deb6

Browse files
committed
Building docker image using docker container
1 parent 0f981b5 commit cf3deb6

File tree

2 files changed

+45
-29
lines changed

2 files changed

+45
-29
lines changed

.circleci/config.yml

Lines changed: 45 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,35 @@ jobs:
214214
(cd dist/test && npm run web)
215215
- store_test_results:
216216
path: dist/test/testResults
217+
dockerBuildPush:
218+
parameters:
219+
release:
220+
type: boolean
221+
default: false
222+
docker:
223+
- image: cimg/base:stable
224+
steps:
225+
- checkout
226+
- setup_remote_docker:
227+
docker_layer_caching: true
228+
- run: |
229+
echo export MB_VERSION=`grep version package.json | sed -e 's/^ "version": "\(.*\)", */\1/'` >> "$BASH_ENV"
230+
- run: |
231+
if [ "<<parameters.release>>" = "true" ]; then
232+
export DOCKER_MB_ALIAS=$([ "$CIRCLE_BRANCH" = "master" ] && echo beta || echo "$CIRCLE_BRANCH")
233+
echo export DOCKER_MB_ALIAS="$DOCKER_MB_ALIAS" >> "$BASH_ENV"
234+
# echo export DOCKER_MB_VERSION=$MB_VERSION-$DOCKER_MB_ALIAS-$CIRCLE_BUILD_NUM-$(echo $CIRCLE_SHA1 | cut -c1-7) >> "$BASH_ENV"
235+
echo export DOCKER_MB_VERSION=$MB_VERSION-$DOCKER_MB_ALIAS-$CIRCLE_BUILD_NUM >> "$BASH_ENV"
236+
else
237+
echo export DOCKER_MB_ALIAS="latest" >> "$BASH_ENV"
238+
echo export DOCKER_MB_VERSION=$MB_VERSION >> "$BASH_ENV"
239+
fi
240+
- run: echo bbyars/mountebank:$DOCKER_MB_VERSION
241+
- run: echo bbyars/mountebank:$DOCKER_MB_ALIAS
242+
- run: docker context create mountebank
243+
- run: docker buildx create --driver docker-container mountebank --use
244+
- run: echo "$DOCKER_PASSWORD" | docker login -u $DOCKER_USER --password-stdin
245+
- run: docker buildx build --platform=linux/arm64,linux/amd64 --tag bbyars/mountebank:$DOCKER_MB_VERSION --tag bbyars/mountebank:$$DOCKER_MB_ALIAS --push .
217246

218247
deploy:
219248
executor: node-active
@@ -225,11 +254,6 @@ jobs:
225254
- run:
226255
name: Publish npm
227256
command: scripts/publishNpm
228-
- run:
229-
name: Publish Docker
230-
command: |
231-
export MB_VERSION=`scripts/printVersion`
232-
scripts/publishDocker $MB_VERSION
233257
- run:
234258
name: Deploy to Heroku
235259
command: scripts/publishHeroku mountebank-dev
@@ -253,11 +277,6 @@ jobs:
253277
- run:
254278
name: Publish npm
255279
command: scripts/publishNpm
256-
- run:
257-
name: Publish Docker
258-
command: |
259-
export MB_VERSION=`scripts/printVersion`
260-
scripts/publishDocker $MB_VERSION
261280
- run:
262281
name: Deploy to Heroku
263282
command: scripts/publishHeroku mountebank
@@ -308,6 +327,15 @@ workflows:
308327
filters:
309328
branches:
310329
only: master
330+
- dockerBuildPush:
331+
requires: # These are technically not necessary
332+
- maintenanceOutOfProcessImposters
333+
- currentWithFileDB
334+
- performance
335+
- web
336+
filters:
337+
branches:
338+
only: master
311339
- deploy:
312340
requires:
313341
- maintenanceOutOfProcessImposters
@@ -325,4 +353,10 @@ workflows:
325353
ignore: /.*/
326354
tags:
327355
only: /^v.*/
328-
356+
- dockerBuildPush:
357+
release: true
358+
filters:
359+
branches:
360+
ignore: /.*/
361+
tags:
362+
only: /^v.*/

scripts/publishDocker

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

0 commit comments

Comments
 (0)