Skip to content

Commit

Permalink
build phase
Browse files Browse the repository at this point in the history
  • Loading branch information
betuah committed Sep 26, 2022
1 parent e03ee27 commit bcb9b11
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/node_modules
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM node:12-alpine
FROM node:16-alpine
RUN apk add g++ make py3-pip

ARG NODE_ENV=production
ARG PORT=80
Expand All @@ -7,11 +8,9 @@ ENV PORT=${PORT}
ENV NODE_ENV=${NODE_ENV}

WORKDIR /usr/src/app

COPY package.json ./
COPY . .
RUN npm install

COPY . .

EXPOSE ${PORT}
CMD [ "npm", "run", "start" ]
22 changes: 17 additions & 5 deletions buildspec.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,39 @@
# Do not change version. This is the version of aws buildspec, not the version of your buldspec file.
version: 0.2

env:
variables:
ECR_REPO: 517312321348.dkr.ecr.us-east-1.amazonaws.com/course-app

phases:
install:
runtime-versions:
nodejs: 16
docker: 18
pre_build:
commands:
- echo Installing source NPM Depedencies...
- echo "Installing source NPM Depedencies.."
- npm install
- echo "Run unit testing.."
- npm run test
- echo ${CODEBUILD_SOURCE_VERSION}
build:
commands:
- echo Run unit testing...
- npm run test
- echo "Build docker image.."
- docker build -t course-catalog .
- echo "Tangging docker image"
- docker tag ${ECR_REPO}:${CODEBUILD_SOURCE_VERSION}
- echo "Build image complete.."
post_build:
commands:
- echo Build completed...
- echo "Build completed.."
- $(aws ecr get-login --no-include-email --region eu-west-1)

reports:
test-report: #surefire junit reports
files:
- 'test-result.xml'
base-directory: 'report/*'
file-format: JUNITXML

artifacts:
files:
Expand Down

0 comments on commit bcb9b11

Please sign in to comment.