Skip to content

Commit

Permalink
Merge branch 'main' into greg-pf/BCDA-8126
Browse files Browse the repository at this point in the history
  • Loading branch information
greg-pf authored Aug 6, 2024
2 parents 686be71 + dd3df58 commit 9ea3491
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
27 changes: 16 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
# Beneficiary Claims Data API

A static Jekyll site for the BCDA splash page: [https://bcda.cms.gov](https://bcda.cms.gov/)

## Requirements

It is assumed that the environment already has these installed:
* [rbenv](https://github.com/rbenv/rbenv) or [rvm](https://rvm.io/) to install versioned ruby
* [ruby](https://www.ruby-lang.org/en/) currently using 2.7.1
* [jekyll](https://jekyllrb.com/) currently using 4.2.0
- [npm](https://www.npmjs.com/) currently using 6.13.4
* [Docker](https://docs.docker.com/install/) to standardize builds across all contributors' local machines
* [Docker Compose](https://docs.docker.com/compose/install/) to define and run multi-container Docker applications

- [rbenv](https://github.com/rbenv/rbenv) or [rvm](https://rvm.io/) to install versioned ruby
- [ruby](https://www.ruby-lang.org/en/) currently using 2.7.1
- [jekyll](https://jekyllrb.com/) currently using 4.2.0

* [npm](https://www.npmjs.com/) currently using 6.13.4

- [Docker](https://docs.docker.com/install/) to standardize builds across all contributors' local machines
- [Docker Compose](https://docs.docker.com/compose/install/) to define and run multi-container Docker applications

## Installation

Navigate to the repository, and install the appropriate Gem file (a Gem file includes the dependencies for Ruby apps):

1. `$ gem install bundler` <— install Gem bundler
2. `$ bundle install` <— install Gem bundles
3. `$ npm install` <- install node dependancies
Expand All @@ -25,8 +32,8 @@ Jekyll builds the CSS and HTML pages. Run `bundle exec jekyll serve` from the pr
Every contributor that uses Docker will have the exact same build as every other contributor. The command for a consistent and simple build process is:

```
docker-compose -f docker-compose.yml build static_site
docker-compose -f docker-compose.yml run --rm static_site
docker compose -f docker-compose.yml build static_site
docker compose -f docker-compose.yml run --rm static_site
```

This process uses a Docker container to execute `bundle exec jekyll build` , compiling site files into the same `_site` directory used when executing this command on the Docker host. The advantage here is that there's no need to install ruby or any dependencies on the machine building the static site — Docker takes care of all that.
Expand All @@ -36,13 +43,11 @@ This process uses a Docker container to execute `bundle exec jekyll build` , com
To host the site in Docker, accessible at `http://localhost:4000/`:

```
docker-compose run --publish 4000:4000 --rm --entrypoint "bundle exec jekyll serve -H 0.0.0.0" static_site
docker compose run --publish 4000:4000 --rm --entrypoint "bundle exec jekyll serve -H 0.0.0.0" static_site
```


This is a convenience meant to ease integration of static site builds with the larger BCDA CI/CD pipeline.


## Installing and Using Pre-commit

Anyone committing to this repo must use the pre-commit hook to lower the likelihood that secrets will be exposed.
Expand Down
6 changes: 3 additions & 3 deletions scripts/build_and_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
set -eo pipefail

docker_cleanup() {
docker-compose down
docker compose down
}

build() {
docker-compose -f docker-compose.yml build static_site
docker compose -f docker-compose.yml build static_site
}

test() {
trap docker_cleanup EXIT
docker-compose run -u "$(id -u "${USER}")":"$(id -g "${USER}")" --publish 4000:4000 --rm --entrypoint "bundle exec jekyll serve -H 0.0.0.0" -d static_site
docker compose run -u "$(id -u "${USER}")":"$(id -g "${USER}")" --publish 4000:4000 --rm --entrypoint "bundle exec jekyll serve -H 0.0.0.0" -d static_site
sleep 20
curl localhost:4000 | grep "Join the Google Group"

Expand Down

0 comments on commit 9ea3491

Please sign in to comment.