Skip to content

Commit

Permalink
Address PR feedback
Browse files Browse the repository at this point in the history
- set default CMD to make it easier to run the container
- add docs to Readme
- ignore node_modules and dist
- print message so user knows when serve.sh is done
  • Loading branch information
olafveerman committed May 9, 2018
1 parent 2ab5416 commit cdd2360
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .build_scripts/serve.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ mv ./dist/* /usr/share/nginx/html
# Make sure nginx stays up once the container is done
echo "daemon off;" >> /etc/nginx/nginx.conf || true

echo 'Starting nginx, access the RAM frontend through your browser.'

# Start nginx
nginx

2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
.travis.yml
.gitignore
.gitattributes
node_modules
dist
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ FROM exiasr/alpine-yarn-nginx
# Add build dependencies
RUN apk add --no-cache make gcc g++ python

ADD . /source
COPY . /source
WORKDIR /source
RUN yarn install

# Remove them to keep image size small
RUN apk del make gcc g++ python

# Build and serve the site
CMD ["sh", "/source/.build_scripts/serve.sh"]
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,19 @@ yarn build
```
This will package the app and place all the contents in the `dist` directory.
The app can then be run by any web server.

## Docker
The RAM frontend is also available in a [Docker container](https://hub.docker.com/r/wbtransport/rra-frontend/). This container builds the site and serves the interface through nginx. [Environment variables](#config-files) will be picked up when the container is run:

``` yml
version: '3'
services:
ram-frontend:
image: wbtransport/ram-frontend
environment:
API: 'https://new.api.io'
ports:
- 8080:80
```
To run the full RAM stack in Docker, you can use the `docker-compose.yml` file that's available in the [RAM backend repo](https://github.com/WorldBank-Transport/ram-backend/blob/develop/docker-compose.yml).

0 comments on commit cdd2360

Please sign in to comment.