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,5 +1,17 @@
FROM mcr.microsoft.com/dotnet/core/sdk:2.1 as build
WORKDIR /licenseGen
COPY . /licenseGen
RUN set -e; set -x; \
dotnet add package Newtonsoft.Json --version 12.0.1 \
&& dotnet restore \
&& dotnet publish
FROM bitbetter/api
COPY bin/Debug/netcoreapp2.0/publish/* /app/
COPY --from=build /licenseGen/bin/Debug/netcoreapp2.0/publish/* /app/
ENTRYPOINT [ "dotnet", "/app/licenseGen.dll", "--core", "/app/Core.dll", "--cert", "/cert.pfx" ]
ENTRYPOINT [ "dotnet", "/app/licenseGen.dll", "--core", "/app/Core.dll", "--cert", "/cert.pfx" ]

View File

@@ -1,11 +1,6 @@
#!/bin/bash
#!/bin/sh
script_dir=`cd $(dirname $0); pwd`
cd $script_dir
dotnet restore
dotnet publish
docker build . -t bitbetter/licensegen # --squash
DIR=`dirname "$0"`
DIR=`exec 2>/dev/null;(cd -- "$DIR") && cd -- "$DIR"|| cd "$DIR"; unset PWD; /usr/bin/pwd || /bin/pwd || pwd`
docker build -t bitbetter/licensegen "$DIR" # --squash

View File

@@ -1,18 +1,19 @@
#!/bin/bash
#!/bin/sh
script_dir=`cd $(dirname $0); pwd`
DIR=`dirname "$0"`
DIR=`exec 2>/dev/null;(cd -- "$DIR") && cd -- "$DIR"|| cd "$DIR"; unset PWD; /usr/bin/pwd || /bin/pwd || pwd`
# Grab the absolute path to the default pfx location
cert_path=`cd ./.keys; ls -d -1 $PWD/cert.pfx`
cert_path="$DIR/.keys/cert.pfx"
if [ "$#" -lt "1" ]; then
echo "USAGE: $0 <ABSOLUTE PATH TO CERT.PFX> [License Gen args...]"
exit 1
elif [ "$#" -ge "2" ]; then
# If a cert path is provided manually, override the default
cert_path=$1
cert_path="$1"
shift
fi
docker run -it -v "$cert_path:/cert.pfx" bitbetter/licensegen "$@"
docker run -it --rm -v "$cert_path:/cert.pfx" bitbetter/licensegen "$@"