Skip to content

Commit

Permalink
Merge pull request #5 from globocom/add-build-stage
Browse files Browse the repository at this point in the history
Add build stage into circleCI and build container instructions into Makefile
  • Loading branch information
rafaveira3 authored Sep 24, 2019
2 parents f0bdefc + cf20ceb commit fe56d77
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
8 changes: 7 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,10 @@ jobs:
- run:
name: "Check security using Yarn Audit"
command: |
make check-sec
make check-sec
- run:
name: "Build files"
command: |
yarn global add react-scripts
yarn install
make build
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Stage 1 - the build process
FROM node as build-deps
WORKDIR /usr/src/app
COPY package.json yarn.lock ./
RUN yarn
COPY . ./
RUN yarn build

# Stage 2 - the production environment
FROM nginx:1.12-alpine
COPY --from=build-deps /usr/src/app/build /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ PROJECT := huskyCI-dashboard
install:
yarn install

## Builds static files from react app.
build:
yarn build

## Runs locally using start command.
run:
yarn start
Expand All @@ -25,6 +29,17 @@ check-sec:
test:
yarn test

## Creates a container image based on most recent dashboard code
build-container:
docker build . -t huskyci/dashboard

## Starts huskyci/dashboard container
start-container:
docker run -p 8080:80 huskyci/dashboard

## Builds and starts dashboard add using huskyci/dashboard container
run-container: build-container start-container

## Shows this help message.
help:
printf "\n${COLOR_YELLOW}${PROJECT}\n------\n${COLOR_RESET}"
Expand Down

0 comments on commit fe56d77

Please sign in to comment.