Skip to content

Commit 9651b5e

Browse files
committed
AR-473: Added docker setup
1 parent 94dad4b commit 9651b5e

File tree

5 files changed

+16875
-34
lines changed

5 files changed

+16875
-34
lines changed

.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
COMPOSE_PROJECT_NAME=display-client
2+
COMPOSE_DOMAIN=display-client.local.itkdev.dk

.github/workflows/pr.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,17 @@ jobs:
1818
${{ runner.os }}-build-${{ env.cache-name }}-
1919
${{ runner.os }}-build-
2020
${{ runner.os }}-
21-
- name: Run install and build assets
22-
run: |
23-
npm install
24-
npm run build
21+
- name: install
22+
run: npm install
23+
- name: Build production assets
24+
run: npm run build
2525

2626
frontend-coding-standards:
2727
name: Frontend coding standards
2828
runs-on: ubuntu-latest
29+
container: node:14
2930
steps:
3031
- uses: actions/checkout@v2
31-
- uses: actions/setup-node@v1
32-
with:
33-
node-version: '14.x'
3432
- name: Cache node modules
3533
uses: actions/cache@v2
3634
env:
@@ -50,11 +48,9 @@ jobs:
5048
frontend-tests:
5149
name: Frontend tests
5250
runs-on: ubuntu-latest
51+
container: node:14
5352
steps:
5453
- uses: actions/checkout@v2
55-
- uses: actions/setup-node@v1
56-
with:
57-
node-version: '14.x'
5854
- name: Cache node modules
5955
uses: actions/cache@v2
6056
env:

README.md

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,39 @@
11
# DisplayClient
2-
A display client for OS2Display ver. 2, currently a work in progress.
32

4-
Currently, this is a create-react-app.
5-
6-
## Docker
3+
The display client for OS2Display ver. 2, currently a work in progress.
74

8-
@TODO: Provide a docker setup, and modify readme to use docker instead.
9-
10-
## Install
5+
Currently, this is a create-react-app.
116

12-
Install the node modules using npm.
7+
## Docker development setup
138

149
```
15-
npm install
16-
```
17-
## Start
10+
# Up the containers
11+
docker-compose up -d
1812
19-
Runs the app in the development mode.
20-
Open http://localhost:3000 to view it in the browser.
13+
# Install npm packages
14+
docker-compose run node bash -c 'npm install'
2115
22-
```
23-
npm start
24-
```
16+
# Restart node
17+
docker-compose restart node
2518
26-
## Build
27-
Builds the app for production to the build folder.
19+
# Follow the node logs to see when the code is compiled.
20+
docker-compose logs -f node
21+
```
2822

29-
@TODO: Add production build instructions.
23+
The display client can opened at `http://display-client.local.itkdev.dk:3001/`.
3024

25+
The code is compiled when changed.
3126

3227
## Coding standards
3328

3429
For code analysis we use the [Airbnb style guide for javascript](https://github.com/airbnb/javascript) and for formatting we use [Prettier](https://github.com/prettier/prettier).
3530

3631
```
3732
# Check for coding standards issues
38-
npm run check-coding-standards
33+
docker-compose exec node bash -c 'npm run check-coding-standards'
3934
4035
# Auto-correct coding standards issues
41-
npm run apply-coding-standards
36+
docker-compose exec node bash -c 'npm run apply-coding-standards'
4237
```
4338

4439
## Testing with cypress
@@ -47,16 +42,23 @@ We use [cypress](https://www.cypress.io/) for testing.
4742

4843

4944
```
50-
npm run test
45+
docker-compose exec node bash -c 'npm run test'
5146
```
5247

5348
Or spinning up electron:
5449

5550
```
56-
test-ui
51+
docker-compose exec node bash -c 'test-ui'
5752
```
5853

5954
## Debug bar
6055

6156
The frontend has a debug bar, that allows for loading fixtures into the react app.
6257
See the `public/fixtures` for the data fixtures.
58+
59+
## Build for production
60+
61+
Builds the app for production to the build folder.
62+
63+
@TODO: Add production build instructions.
64+

docker-compose.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ networks:
1010
services:
1111
node:
1212
image: node:14
13+
command: npm start
1314
networks:
1415
- app
1516
- frontend
1617
working_dir: /app
1718
ports:
18-
- '80'
19+
- '3001:3000'
1920
environment:
2021
- NODE_ENV=development
2122
volumes:

0 commit comments

Comments
 (0)