Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
brentley committed Feb 15, 2018
0 parents commit 2c7781e
Show file tree
Hide file tree
Showing 12 changed files with 1,042 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
npm-debug.log
.git
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# FROM node:alpine
FROM alpine:3.6

# set the default NODE_ENV to production
# for dev/test build with: docker build --build-arg NODE=development .
# and the testing npms will be included
ARG NODE=production
ENV NODE_ENV ${NODE}

# copy package info early to install npms and delete npm command
WORKDIR /usr/src/app
COPY package*.json ./
RUN apk -U add nodejs nodejs-npm && \
npm install && apk del --purge nodejs-npm && \
rm -rvf /var/cache/* /root/.npm /tmp/*

# copy the code
COPY . .
EXPOSE 3000
CMD [ "node", "server.js" ]
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Amazon ECS Workshop

This is part of an Amazon ECS workshop at https://ecsworkshop.com
13 changes: 13 additions & 0 deletions buildspec-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 0.2

phases:
install:
commands:
- export IMAGE_TAG=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
- export ACCOUNT=$(echo $CODEBUILD_BUILD_ARN |cut -f5 -d:)
- export $(cat mu-env.sh)
- echo '***** This is the current env:'
- printenv
build:
commands:
- curl -m3 -sL -w "%{http_code}\\n" "$BASE_URL" -o /dev/null
32 changes: 32 additions & 0 deletions buildspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
version: 0.2

phases:
install:
commands:
- export IMAGE_TAG=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
- export ACCOUNT=$(echo $CODEBUILD_BUILD_ARN |cut -f5 -d:)
- echo '***** This is the current env:'
- printenv
#- echo '***** Download nodejs repo:'
#- curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
#- echo '***** install nodejs:'
#- apt-get install -y nodejs build-essential
#- echo '***** install our npms:'
#- npm install
build:
commands:
#- echo '***** run tests:'
#- npm test -- > testresult.txt
# - docker build -t myimage .
post_build:
commands:
- printf '[{"name":"example-backend","imageUri":"%s"}]' $REPOSITORY_URI:$IMAGE_TAG > imagedefinitions.json
- echo $IMAGE_TAG > code_hash.txt
# - docker pull anchore/cli
# - docker run -d -v $(pwd):/source-dir -v /var/run/docker.sock:/var/run/docker.sock --name anchore anchore/cli:latest
# - docker exec anchore anchore feeds sync
# - docker exec anchore anchore analyze --image myimage --dockerfile /source-dir/Dockerfile

artifacts:
files:
- '**/*'
1 change: 1 addition & 0 deletions code_hash.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NOHASH
16 changes: 16 additions & 0 deletions mu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
service:
desiredCount: 3
maxSize: 6
port: 3000
priority: 50
pathPatterns:
- /*
networkMode: awsvpc
parameters:
'mu-service-ecsdemo-nodejs-acceptance':
ElbHttpListenerArn:
mu-loadbalancer-acceptance-BackendLBHttpListenerArn
'mu-service-ecsdemo-nodejs-production':
ElbHttpListenerArn:
mu-loadbalancer-production-BackendLBHttpListenerArn
Loading

0 comments on commit 2c7781e

Please sign in to comment.