Skip to content

Commit e7f3a6e

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

2 files changed

Lines changed: 37 additions & 23 deletions

File tree

.circleci/config.yml

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,34 @@ 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+
else
236+
echo export DOCKER_MB_ALIAS="latest" >> "$BASH_ENV"
237+
echo export DOCKER_MB_VERSION=$MB_VERSION >> "$BASH_ENV"
238+
fi
239+
- run: echo bbyars/mountebank:$DOCKER_MB_VERSION
240+
- run: echo bbyars/mountebank:$DOCKER_MB_ALIAS
241+
- run: docker context create mountebank
242+
- run: docker buildx create --driver docker-container mountebank --use
243+
- run: echo "$DOCKER_PASSWORD" | docker login -u $DOCKER_USER --password-stdin
244+
- run: docker buildx build --platform=linux/arm64,linux/amd64 --tag bbyars/mountebank:$DOCKER_MB_VERSION --tag bbyars/mountebank:$$DOCKER_MB_ALIAS --push .
217245

218246
deploy:
219247
executor: node-active
@@ -225,11 +253,6 @@ jobs:
225253
- run:
226254
name: Publish npm
227255
command: scripts/publishNpm
228-
- run:
229-
name: Publish Docker
230-
command: |
231-
export MB_VERSION=`scripts/printVersion`
232-
scripts/publishDocker $MB_VERSION
233256
- run:
234257
name: Deploy to Heroku
235258
command: scripts/publishHeroku mountebank-dev
@@ -308,6 +331,15 @@ workflows:
308331
filters:
309332
branches:
310333
only: master
334+
- dockerBuildPush:
335+
requires: # These are technically not necessary
336+
- maintenanceOutOfProcessImposters
337+
- currentWithFileDB
338+
- performance
339+
- web
340+
filters:
341+
branches:
342+
only: master
311343
- deploy:
312344
requires:
313345
- maintenanceOutOfProcessImposters

scripts/publishDocker

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

0 commit comments

Comments
 (0)