Improve build and scripts (#30)

* Use absolute path rather than relative path in scripts

* Remove src/bitBetter/.keys/cert.cert

* Build licenseGen in Docker
This way we don't have to install dotnet sdk on the host

* Build bitBetter in Docker
This way we don't have to install dotnet sdk on the host

* Change DIR in run.sh to point to the project root

* Replace echo in Dockerfiles by set -x and set -e

* Use same Dockerfile for api and identity images

* Update README.md

* Update CircleCI config
The Docker Executor can't mount volume.
https://support.circleci.com/hc/en-us/articles/360007324514
https://circleci.com/docs/2.0/executor-types/#using-machine

* Make scripts work with sh

* Remove the container used to build bitBetter
This commit is contained in:
Vinrobot
2019-07-07 18:18:27 +02:00
committed by Jeff Alyanak
parent 5d01d3c661
commit 3e44d7347b
12 changed files with 67 additions and 80 deletions

View File

@@ -1,24 +1,18 @@
#!/bin/bash
#!/bin/sh
DIR=`dirname "$0"`
DIR=`exec 2>/dev/null;(cd -- "$DIR") && cd -- "$DIR"|| cd "$DIR"; unset PWD; /usr/bin/pwd || /bin/pwd || pwd`
# If there aren't any keys, generate them first.
[ -e ./.keys/cert.cert ] || ./.keys/generate-keys.sh
[ -e "$DIR/.keys/cert.cert" ] || "$DIR/.keys/generate-keys.sh"
[ -e ./src/bitBetter/api/.keys ] || mkdir ./src/bitBetter/api/.keys
[ -e ./src/bitBetter/identity/.keys ] || mkdir ./src/bitBetter/identity/.keys
[ -e "$DIR/src/bitBetter/.keys" ] || mkdir "$DIR/src/bitBetter/.keys"
cp .keys/cert.cert ./src/bitBetter/api/.keys
cp .keys/cert.cert ./src/bitBetter/identity/.keys
cp "$DIR/.keys/cert.cert" "$DIR/src/bitBetter/.keys"
cd ./src/bitBetter
docker run --rm -v "$DIR/src/bitBetter:/bitBetter" -w=/bitBetter mcr.microsoft.com/dotnet/core/sdk:2.1 sh build.sh
dotnet restore
dotnet publish
docker build --build-arg BITWARDEN_TAG=bitwarden/api -t bitbetter/api "$DIR/src/bitBetter" # --squash
docker build --build-arg BITWARDEN_TAG=bitwarden/identity -t bitbetter/identity "$DIR/src/bitBetter" # --squash
cp -r bin/ api/
cp -r bin/ identity/
cd ./api
docker build --pull . -t bitbetter/api # --squash
cd ../identity
docker build --pull . -t bitbetter/identity # --squash