forked from attlas/attlas-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Squashed 'services/auth/' changes from 5cd7788..1c7de1a
1c7de1a Merge pull request attlas#23 from VladyslavKurmaz/master ea8ebbc Docker support 7d1fe6d Docker support git-subtree-dir: services/auth git-subtree-split: 1c7de1a7879c3a1384dd70d63027d0613bbddcf5
- Loading branch information
1 parent
e3691fd
commit e6ac8e2
Showing
15 changed files
with
129 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,22 @@ | ||
#!/bin/bash -e | ||
|
||
# can be used for standalon project | ||
#:' | ||
export $(cat ./.env | grep -v ^# | xargs) | ||
#' | ||
if [ -f './../../.env' ]; then | ||
echo '## Export variables from project .env file' | ||
export $(cat ./../../.env | grep -v ^# | xargs) | ||
export COMPONENT_ID="${ID}" | ||
export COMPONENT_VERSION=${PROJECT_VERSION} | ||
export COMPONENT_PARAM_HOST=${HOST} | ||
export COMPONENT_PARAM_LSTN=${LSTN} | ||
export COMPONENT_PARAM_PORT=${PORT} | ||
export COMPONENT_PARAM_PORTS=${PORTS} | ||
export COMPONENT_PARAM_SECRET=${SECRET} | ||
# export configuration from the top level of microservice | ||
: ' | ||
export $(cat ./../../.env | grep -v ^# | xargs) | ||
export COMPONENT_ID="${ID}" | ||
export COMPONENT_VERSION=${PROJECT_VERSION} | ||
export COMPONENT_PARAM_HOST=${HOST} | ||
export COMPONENT_PARAM_LSTN=${LSTN} | ||
export COMPONENT_PARAM_PORT=${PORT} | ||
export COMPONENT_PARAM_PORTS=${PORTS} | ||
export COMPONENT_PARAM_SECRET=${SECRET} | ||
' | ||
printenv | grep COMPONENT_ | ||
# project specific mappings | ||
fi | ||
if [ -f './.env' ]; then | ||
echo '## Export variables from local .env file' | ||
export $(cat ./.env | grep -v ^# | xargs) | ||
fi | ||
printenv | grep COMPONENT_ | sort |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{ | ||
"stages":{ | ||
"prereq":{ | ||
"shell":[ | ||
"envsubst < .env.template > .env", | ||
"envsubst < sonar-project.properties.template > sonar-project.properties" | ||
] | ||
}, | ||
"build":{ | ||
"shell":[ | ||
". ./.env.sh", | ||
"npm i" | ||
] | ||
}, | ||
"test":{ | ||
"shell":[ | ||
". ./.env.sh", | ||
"npm run jasmine" | ||
] | ||
}, | ||
"serve":{ | ||
"shell":[ | ||
". ./.env.sh", | ||
"npm run serve" | ||
] | ||
}, | ||
"docker.build":{ | ||
"shell":[ | ||
". ./.env.sh", | ||
"docker build -t ${COMPONENT_ID}:${COMPONENT_VERSION} ." | ||
] | ||
}, | ||
"docker.run":{ | ||
"shell":[ | ||
". ./.env.sh", | ||
"docker run -d --rm \\", | ||
" -p $COMPONENT_PARAM_PORT:$COMPONENT_PARAM_PORT \\", | ||
" -p $COMPONENT_PARAM_PORTS:$COMPONENT_PARAM_PORTS \\", | ||
" --name ${COMPONENT_ID} ${COMPONENT_ID}:${COMPONENT_VERSION}" | ||
] | ||
}, | ||
"docker.save":{ | ||
"shell":[ | ||
". ./.env.sh", | ||
"docker save -o ${COMPONENT_ID}-${COMPONENT_VERSION}.tar ${COMPONENT_ID}:${COMPONENT_VERSION}" | ||
] | ||
}, | ||
"docker.load":{ | ||
"shell":[ | ||
". ./.env.sh", | ||
"docker load -i ${COMPONENT_ID}-${COMPONENT_VERSION}.tar" | ||
] | ||
}, | ||
|
||
"docker.stop":{ | ||
"shell":[ | ||
". ./.env.sh", | ||
"docker stop ${COMPONENT_ID}", | ||
"docker rmi ${COMPONENT_ID}:${COMPONENT_VERSION}" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
FROM node:9.10.1-alpine | ||
|
||
# Create app directory | ||
WORKDIR /usr/src/app | ||
|
||
# Copy sources | ||
COPY ./package*.json ./ | ||
COPY ./src ./src | ||
COPY ./.env.template ./ | ||
COPY ./docker-entry.sh ./ | ||
|
||
# Install app dependencies | ||
RUN apk --update --no-cache add git gettext | ||
RUN npm install --only=production | ||
|
||
CMD [ "./docker-entry.sh" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
#!/bin/bash -e | ||
|
||
. ./.env.sh | ||
npm i | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
envsubst < .env.template > .env | ||
exec npm start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash -e | ||
. ./.env.sh | ||
docker build -t ${COMPONENT_ID}:${COMPONENT_VERSION} . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash -e | ||
. ./.env.sh | ||
docker load -i ${COMPONENT_ID}-${COMPONENT_VERSION}.tar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash -e | ||
. ./.env.sh | ||
docker run -d --rm \ | ||
-p $COMPONENT_PARAM_PORT:$COMPONENT_PARAM_PORT \ | ||
-p $COMPONENT_PARAM_PORTS:$COMPONENT_PARAM_PORTS \ | ||
--name ${COMPONENT_ID} ${COMPONENT_ID}:${COMPONENT_VERSION} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash -e | ||
. ./.env.sh | ||
docker save -o ${COMPONENT_ID}-${COMPONENT_VERSION}.tar ${COMPONENT_ID}:${COMPONENT_VERSION} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash -e | ||
. ./.env.sh | ||
docker stop ${COMPONENT_ID} | ||
docker rmi ${COMPONENT_ID}:${COMPONENT_VERSION} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
#!/bin/bash -e | ||
envsubst < .env.template > .env | ||
envsubst < sonar-project.properties.template > sonar-project.properties | ||
|
||
./build.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
#!/bin/bash -e | ||
|
||
. ./.env.sh | ||
npm run serve |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
#!/bin/bash -e | ||
|
||
. ./.env.sh | ||
npm run jasmine | ||
|
||
# enum and run all sh scripts from spec/**/*.sh |