-
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.
- Loading branch information
Showing
5 changed files
with
91 additions
and
2 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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Dockerfile | ||
.dockerignore | ||
docker.sh | ||
|
||
.idea | ||
.vscode | ||
.git | ||
.gitignore | ||
.travis.yml | ||
|
||
*/node_modules | ||
*/_build | ||
|
||
**/npm-*.log | ||
**/yarn-*.log | ||
**/catapult-*.log |
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,14 @@ | ||
FROM node:12.18.1-alpine | ||
RUN apk add --update\ | ||
python \ | ||
python3 \ | ||
build-base \ | ||
zeromq-dev \ | ||
&& rm -rf /var/cache/apk/* | ||
WORKDIR /app | ||
COPY . /app/catapult-rest | ||
RUN cd catapult-rest \ | ||
&& ./yarn_setup.sh | ||
RUN cd catapult-rest/rest \ | ||
&& yarn build | ||
WORKDIR /app/catapult-rest/rest |
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,44 @@ | ||
#!/bin/sh | ||
|
||
if [ "${DOCKER_IMAGE_NAME}" = "" ] | ||
then | ||
echo "Docker deployment error. Env DOCKER_IMAGE_NAME has not been provided" | ||
exit 128 | ||
fi | ||
|
||
if [ "${DOCKER_USERNAME}" = "" ] | ||
then | ||
echo "Docker deployment error. Env DOCKER_USERNAME has not been provided" | ||
exit 128 | ||
fi | ||
|
||
if [ "${DOCKER_PASSWORD}" = "" ] | ||
then | ||
echo "Docker deployment error. Env DOCKER_PASSWORD has not been provided" | ||
exit 128 | ||
fi | ||
|
||
echo "Login into docker..." | ||
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin | ||
|
||
cd rest | ||
CURRENT_VERSION=$(npm run version --silent) | ||
cd .. | ||
|
||
if [ "$1" = "--release" ] | ||
then | ||
VERSION="${CURRENT_VERSION}" | ||
else | ||
VERSION="${CURRENT_VERSION}-alpha" | ||
fi | ||
|
||
echo "Creating image ${DOCKER_IMAGE_NAME}:${VERSION}" | ||
docker build -t "${DOCKER_IMAGE_NAME}:${VERSION}" . | ||
docker images | ||
|
||
# Quick test, the expected error is ENOENT: no such file or directory, open '../resources/rest.json' | ||
echo "Testing image ${DOCKER_IMAGE_NAME}:${VERSION}. NOTE: ENOENT: no such file or directory, open '../resources/rest.json is expected" | ||
docker run --rm "${DOCKER_IMAGE_NAME}:${VERSION}" npm start | ||
|
||
echo "Pushing image ${DOCKER_IMAGE_NAME}:${VERSION}" | ||
docker push "${DOCKER_IMAGE_NAME}:${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