Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Docker image #631

Open
wants to merge 2 commits into
base: main
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
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
usage-data-config.json
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM node:8.12-alpine

ADD . /app
WORKDIR /app

ARG COLLECT_USAGE_DATA=true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should probably be false by default

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it need a default value? Can we ask users the same as normal?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think because heroku bypasses this we've not run into it before, I ran into this same issue trying to get the kit running in Glitch, maybe there's a way we could timeout the question or have an environment variable, or something else to stop the server from stalling.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When pushing an image to the platform, interactive mod isn't a thing. Nor is by default on local environments.

We considered setting this to false, however we didn't want to step on your toes too much :)

Happy to set it to false.


RUN npm install
RUN echo "{\"collectUsageData\": $COLLECT_USAGE_DATA}" > usage-data-config.json

EXPOSE 3000
CMD ["npm", "start"]
43 changes: 40 additions & 3 deletions docs/documentation/install/developer-install-instructions.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,57 @@
# Instructions for developers

There are multiple ways of running the application locally.

## Native

It's built on the [Express](http://expressjs.com/) framework, and uses [GOV.UK Frontend](https://github.com/alphagov/govuk-frontend).

## Requirements
### Requirements

node.js - version 8.x.x

## Install dependencies
### Install dependencies

```
npm install
```

## Run the kit
### Run the kit
```
npm start
```

Go to [localhost:3000](http://localhost:3000) in your browser.

## Docker

You may choose to run the application in the docker environment. Doing so you'd
probably be driven by some of the following:

- avoid installing/managing node on your machine
- avoid remembering to install/compile dependencies
- running application in an artifact way
- ability to push to Kubernetes (RE Build & Run) or CloudFoundry (GOV.UK PaaS)
- run in _production-like_ environment

We've placed a `Dockerfile` in the root of the project.

You can build an image by running the following:

```
docker build . -t govuk-prototype-kit:latest
```

This step will pull a small image containing a base operating system with node
pre-installed. Additionally, will mount your current working directory along
with installing some `node_modules`.

You can run it afterwards with:

```
docker run -p 3000:3000 govuk-prototype-kit:latest
```

The application will listen on your exposed port (`3000` in this case). You
should be able to visit http://localhost:3000/