10 changed files with 40 additions and 164 deletions
@ -1,33 +0,0 @@ |
|||
# specify the node base image with your desired version |
|||
FROM balenalib/armv7hf-node:8-stretch-run |
|||
|
|||
# need qemu to emulate arm architecture |
|||
# can be downloaded here, $ docker run -v /usr/bin/qemu-arm-static:/usr/bin/qemu-arm-static --rm -ti arm32v7/debian:stretch-slim |
|||
COPY ./qemu-arm-static /usr/bin/qemu-arm-static |
|||
|
|||
# install tools |
|||
RUN apt-get update --no-install-recommends \ |
|||
&& apt-get install -y --no-install-recommends curl \ |
|||
&& apt-get install -y --no-install-recommends rsync \ |
|||
&& apt-get install -y --no-install-recommends vim \ |
|||
&& rm -rf /var/lib/apt/lists/* |
|||
|
|||
# Create app directory |
|||
WORKDIR /usr/src/app |
|||
|
|||
# Install app dependencies |
|||
# A wildcard is used to ensure both package.json AND package-lock.json are copied |
|||
# where available (npm@5+) |
|||
COPY package*.json ./ |
|||
|
|||
RUN npm install |
|||
# If you are building your code for production |
|||
# RUN npm install --only=production |
|||
|
|||
# Bundle app source |
|||
COPY . . |
|||
|
|||
RUN mkdir -p /root/.lnd |
|||
|
|||
EXPOSE 3005 |
|||
CMD [ "npm", "start" ] |
@ -1,19 +0,0 @@ |
|||
#!/usr/bin/env bash |
|||
|
|||
if [[ "$ARCH" != "arm" && "$ARCH" != "x86" ]] ; then |
|||
echo 'Please set an ARCH to x86 or arm.' |
|||
return |
|||
fi |
|||
|
|||
if [[ -z "$ENV" ]] ; then |
|||
echo 'Please set an ENV variable.' |
|||
return |
|||
fi |
|||
|
|||
DOCKERFILE="Dockerfile" |
|||
if [ "$ARCH" = "arm" ]; then |
|||
DOCKERFILE="Dockerfile.armhf" |
|||
fi |
|||
|
|||
docker build . -f $DOCKERFILE -t casanodeinternal/lnapi:$ARCH-$ENV |
|||
docker push casanodeinternal/lnapi:$ARCH-$ENV |
@ -1,88 +0,0 @@ |
|||
version: 0.2 |
|||
env: |
|||
parameter-store: |
|||
DOCKER_HUB_USER: "/Casanode/DockerHub/User" |
|||
DOCKER_HUB_PASS: "/Casanode/DockerHub/Pass" |
|||
GITHUB_USER: "/Casanode/Git/User" |
|||
GITHUB_PASS: "/Casanode/Git/Pass" |
|||
phases: |
|||
pre_build: |
|||
commands: |
|||
- echo Installing source NPM dependencies... |
|||
- npm install |
|||
install: |
|||
commands: |
|||
# CodePipeline creates artifacts using zip format, which does not preserve the permissions/modes. |
|||
# we must reset permissions here |
|||
- chmod 755 pre-commit qemu-arm-static |
|||
build: |
|||
commands: |
|||
- echo Running tests |
|||
- if [ -z $CODECOV_TOKEN ]; then npm run test; else npm run coverage; fi |
|||
|
|||
- echo Building the Docker image ... |
|||
|
|||
# building |
|||
# Remove qemu-static if non-arm, or register |
|||
- | |
|||
if [ $ARCH != arm ]; then |
|||
rm qemu-arm-static |
|||
else |
|||
docker run --rm --privileged multiarch/qemu-user-static:register --reset |
|||
fi |
|||
- docker build . -f $DOCKERFILE -t $ORGANIZATION/$REPOSITORY:$ARCH |
|||
- docker tag $ORGANIZATION/$REPOSITORY:$ARCH $ORGANIZATION/$REPOSITORY:$ARCH |
|||
|
|||
# Hacky way to determine what branch we are in. $CODEBUILD_SOURCE_VERSION is the git commit we are currently |
|||
# building. We search all local branches to get a list of branches that include that git commit. We return all |
|||
# alpha characters from the branch we are looking for. |
|||
# |
|||
# Ex. |
|||
# master => master |
|||
# release/1.0.0 => release |
|||
|
|||
- masterBranchText=$(git branch --contains $CODEBUILD_SOURCE_VERSION | grep master | sed 's/[^a-zA-Z]//g') |
|||
- releaseBranchText=$(git branch --contains $CODEBUILD_SOURCE_VERSION | grep release | sed 's/[^a-zA-Z]//g') |
|||
- developBranchText=$(git branch --contains $CODEBUILD_SOURCE_VERSION | grep develop | sed 's/[^a-zA-Z]//g') |
|||
|
|||
# push image to docker |
|||
- docker login --username=$DOCKER_HUB_USER --password=$DOCKER_HUB_PASS |
|||
|
|||
# Since a git commit can be in multiple branches, we will start with master and work our way down. If a git commit |
|||
# exists in master, release, and develop, it really means we want to deploy master. Likewise, if a git commit exists |
|||
# in release and develop, we release want to deploy release. |
|||
# |
|||
# Public vs Private |
|||
# Casa Inc releases code publicly for various reasons. We also develop features in private before the public |
|||
# release. Historically we have used the private casacomputer organization on docker hub. We have since migrated |
|||
# to casanode for our public releases. We will support legacy nodes running on casacomputer until March 2020. |
|||
- | |
|||
if [ "$masterBranchText" = "master" ] && [ "$PUBLIC" = "false" ]; then |
|||
echo "pushing master branch to docker hub" |
|||
docker tag $ORGANIZATION/$REPOSITORY:$ARCH $ORGANIZATION/$REPOSITORY:$ARCH |
|||
docker push $ORGANIZATION/$REPOSITORY:$ARCH |
|||
elif [ "$masterBranchText" = "master" ] && [ "$PUBLIC" = "true" ]; then |
|||
echo "pushing master branch to docker hub" |
|||
docker tag $ORGANIZATION/$REPOSITORY:$ARCH $ORGANIZATION/$REPOSITORY:$ARCH |
|||
docker push $ORGANIZATION/$REPOSITORY:$ARCH |
|||
|
|||
echo "pushing master branch to legacy docker hub" |
|||
docker tag casacomputer/$REPOSITORY:$ARCH casacomputer/$REPOSITORY:$ARCH |
|||
docker push casacomputer/$REPOSITORY:$ARCH |
|||
elif [ "$releaseBranchText" = "release" ] && [ "$PUBLIC" = "false" ]; then |
|||
echo "pushing release branch to docker hub" |
|||
docker tag $ORGANIZATION/$REPOSITORY:$ARCH $ORGANIZATION/$REPOSITORY:$ARCH-stage |
|||
docker push $ORGANIZATION/$REPOSITORY:$ARCH-stage |
|||
elif [ "$developBranchText" = "develop" ] && [ "$PUBLIC" = "false" ]; then |
|||
echo "pushing develop branch to docker hub" |
|||
docker tag $ORGANIZATION/$REPOSITORY:$ARCH $ORGANIZATION/$REPOSITORY:$ARCH-develop |
|||
docker push $ORGANIZATION/$REPOSITORY:$ARCH-develop |
|||
else |
|||
echo "docker image has been built, but not pushed to docker hub" |
|||
fi |
|||
post_build: |
|||
commands: |
|||
- echo Build completed on `date` |
|||
cache: |
|||
paths: |
|||
- 'node_modules/**/*' |
Loading…
Reference in new issue