Skip to content
This repository has been archived by the owner on Jan 18, 2023. It is now read-only.

Initial PR for setting up circleCI and dockerfile #135

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: 2.1

# using circleci orbs for easy understanding and clean ci setup
orbs:
aws-ecs: circleci/[email protected]
aws-ecr: circleci/[email protected]

workflows:
build-and-deploy:
jobs:
- aws-ecr/build-and-push-image:
repo: "calculator"
# using commit information as tag
tag: "latest"

- aws-ecs/deploy-service-update:
# making sure deployment is run only after successful image build and push
requires:
- aws-ecr/build-and-push-image
family: "calculator"
cluster: "calculator"
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Base image
FROM node:16-alpine

# Add group and user to avoid root user usage for security reasons.
RUN addgroup calgroup
RUN adduser -D caluser calgroup

# copy source code and set up work directory
RUN mkdir /calculator
COPY . /calculator
WORKDIR /calculator

# change ownership of work directory and use created user
RUN chown -R caluser:calgroup /calculator
USER caluser

#intimate docker which port will be used
EXPOSE 3000

# Run application
RUN npm install
CMD ["npm", "start"]