Skip to content

Commit 2c7781e

Browse files
committed
initial commit
0 parents  commit 2c7781e

12 files changed

+1042
-0
lines changed

.dockerignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
npm-debug.log
3+
.git

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

Dockerfile

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# FROM node:alpine
2+
FROM alpine:3.6
3+
4+
# set the default NODE_ENV to production
5+
# for dev/test build with: docker build --build-arg NODE=development .
6+
# and the testing npms will be included
7+
ARG NODE=production
8+
ENV NODE_ENV ${NODE}
9+
10+
# copy package info early to install npms and delete npm command
11+
WORKDIR /usr/src/app
12+
COPY package*.json ./
13+
RUN apk -U add nodejs nodejs-npm && \
14+
npm install && apk del --purge nodejs-npm && \
15+
rm -rvf /var/cache/* /root/.npm /tmp/*
16+
17+
# copy the code
18+
COPY . .
19+
EXPOSE 3000
20+
CMD [ "node", "server.js" ]

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Amazon ECS Workshop
2+
3+
This is part of an Amazon ECS workshop at https://ecsworkshop.com

buildspec-test.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: 0.2
2+
3+
phases:
4+
install:
5+
commands:
6+
- export IMAGE_TAG=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
7+
- export ACCOUNT=$(echo $CODEBUILD_BUILD_ARN |cut -f5 -d:)
8+
- export $(cat mu-env.sh)
9+
- echo '***** This is the current env:'
10+
- printenv
11+
build:
12+
commands:
13+
- curl -m3 -sL -w "%{http_code}\\n" "$BASE_URL" -o /dev/null

buildspec.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
version: 0.2
2+
3+
phases:
4+
install:
5+
commands:
6+
- export IMAGE_TAG=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
7+
- export ACCOUNT=$(echo $CODEBUILD_BUILD_ARN |cut -f5 -d:)
8+
- echo '***** This is the current env:'
9+
- printenv
10+
#- echo '***** Download nodejs repo:'
11+
#- curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
12+
#- echo '***** install nodejs:'
13+
#- apt-get install -y nodejs build-essential
14+
#- echo '***** install our npms:'
15+
#- npm install
16+
build:
17+
commands:
18+
#- echo '***** run tests:'
19+
#- npm test -- > testresult.txt
20+
# - docker build -t myimage .
21+
post_build:
22+
commands:
23+
- printf '[{"name":"example-backend","imageUri":"%s"}]' $REPOSITORY_URI:$IMAGE_TAG > imagedefinitions.json
24+
- echo $IMAGE_TAG > code_hash.txt
25+
# - docker pull anchore/cli
26+
# - docker run -d -v $(pwd):/source-dir -v /var/run/docker.sock:/var/run/docker.sock --name anchore anchore/cli:latest
27+
# - docker exec anchore anchore feeds sync
28+
# - docker exec anchore anchore analyze --image myimage --dockerfile /source-dir/Dockerfile
29+
30+
artifacts:
31+
files:
32+
- '**/*'

code_hash.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
NOHASH

mu.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
service:
3+
desiredCount: 3
4+
maxSize: 6
5+
port: 3000
6+
priority: 50
7+
pathPatterns:
8+
- /*
9+
networkMode: awsvpc
10+
parameters:
11+
'mu-service-ecsdemo-nodejs-acceptance':
12+
ElbHttpListenerArn:
13+
mu-loadbalancer-acceptance-BackendLBHttpListenerArn
14+
'mu-service-ecsdemo-nodejs-production':
15+
ElbHttpListenerArn:
16+
mu-loadbalancer-production-BackendLBHttpListenerArn

0 commit comments

Comments
 (0)