Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 45 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,35 @@ jobs:
(cd dist/test && npm run web)
- store_test_results:
path: dist/test/testResults
dockerBuildPush:
parameters:
release:
type: boolean
default: false
docker:
- image: cimg/base:stable
steps:
- checkout
- setup_remote_docker:
docker_layer_caching: true
- run: |
echo export MB_VERSION=`grep version package.json | sed -e 's/^ "version": "\(.*\)", */\1/'` >> "$BASH_ENV"
- run: |
if [ "<<parameters.release>>" = "true" ]; then
export DOCKER_MB_ALIAS=$([ "$CIRCLE_BRANCH" = "master" ] && echo beta || echo "$CIRCLE_BRANCH")
echo export DOCKER_MB_ALIAS="$DOCKER_MB_ALIAS" >> "$BASH_ENV"
# echo export DOCKER_MB_VERSION=$MB_VERSION-$DOCKER_MB_ALIAS-$CIRCLE_BUILD_NUM-$(echo $CIRCLE_SHA1 | cut -c1-7) >> "$BASH_ENV"
echo export DOCKER_MB_VERSION=$MB_VERSION-$DOCKER_MB_ALIAS-$CIRCLE_BUILD_NUM >> "$BASH_ENV"
else
echo export DOCKER_MB_ALIAS="latest" >> "$BASH_ENV"
echo export DOCKER_MB_VERSION=$MB_VERSION >> "$BASH_ENV"
fi
- run: echo bbyars/mountebank:$DOCKER_MB_VERSION
- run: echo bbyars/mountebank:$DOCKER_MB_ALIAS
- run: docker context create mountebank
- run: docker buildx create --driver docker-container mountebank --use
- run: echo "$DOCKER_PASSWORD" | docker login -u $DOCKER_USER --password-stdin
- run: docker buildx build --platform=linux/arm64,linux/amd64 --tag bbyars/mountebank:$DOCKER_MB_VERSION --tag bbyars/mountebank:$$DOCKER_MB_ALIAS --push .

deploy:
executor: node-active
Expand All @@ -225,11 +254,6 @@ jobs:
- run:
name: Publish npm
command: scripts/publishNpm
- run:
name: Publish Docker
command: |
export MB_VERSION=`scripts/printVersion`
scripts/publishDocker $MB_VERSION
- run:
name: Deploy to Heroku
command: scripts/publishHeroku mountebank-dev
Expand All @@ -253,11 +277,6 @@ jobs:
- run:
name: Publish npm
command: scripts/publishNpm
- run:
name: Publish Docker
command: |
export MB_VERSION=`scripts/printVersion`
scripts/publishDocker $MB_VERSION
- run:
name: Deploy to Heroku
command: scripts/publishHeroku mountebank
Expand Down Expand Up @@ -308,6 +327,15 @@ workflows:
filters:
branches:
only: master
- dockerBuildPush:
requires: # These are technically not necessary
- maintenanceOutOfProcessImposters
- currentWithFileDB
- performance
- web
filters:
branches:
only: master
- deploy:
requires:
- maintenanceOutOfProcessImposters
Expand All @@ -325,4 +353,10 @@ workflows:
ignore: /.*/
tags:
only: /^v.*/

- dockerBuildPush:
release: true
filters:
branches:
ignore: /.*/
tags:
only: /^v.*/
13 changes: 12 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
# syntax=docker/dockerfile:1
FROM node:18-alpine AS builder
ADD . .
# Validate versions
RUN node -v && npm -v
# Install Dependencies
RUN npm ci
# Version
RUN node tasks/version.js
RUN npm run jsdoc
# Dist
RUN node tasks/dist.js

FROM node:18-alpine

WORKDIR /app

# Install tarball to allow the command to be 'mb' instead of 'bin/mb'
COPY mountebank-*.tgz ./
COPY --from=builder dist/mountebank/mountebank-*.tgz ./
RUN npm install --production -g mountebank-*.tgz && npm cache clean -f

# Run as a non-root user
Expand Down
29 changes: 29 additions & 0 deletions Dockerfile.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Ignore everything that is not white listed below
*

!/.codeclimate.yml
!/.eslintignore
!/.eslintrc
!/.jsdoc
!/.mdlrc
!/.npmrc
!/.nvmrc
!/.scannerwork
!/CODE_OF_CONDUCT.md
!/CONTRIBUTING.md
!/Dockerfile
!/Dockerfile.dockerignore
!/LICENSE
!/README.md
!/bin
!/docs
!/images
!/mbTest
!/package-lock.json
!/package.json
!/releases.json
!/scripts
!/src
!/tasks
!/test

18 changes: 0 additions & 18 deletions scripts/publishDocker

This file was deleted.

Loading