Skip to content
This repository was archived by the owner on Jul 7, 2025. It is now read-only.
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
11 changes: 11 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
node_modules
lib
__tests__
.merlin
core
build
public
.bsb.lock
npm-debug.log
coverage
*.bs.js
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ public/*
.bsb.lock
core
npm-debug.log
/lib/bs/
lib
.nyc_output
yarn-error.log
coverage
Expand Down
16 changes: 16 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM node:stretch

EXPOSE 8080

WORKDIR /opt/src

COPY package.json .
COPY package-lock.json .

RUN apt-get update
RUN apt-get install build-essential -y
RUN npm install --ignore-engines

CMD ["npm" "start"]

# vim: set ft=dockerfile:
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,25 @@ npm run start:prod # Run in production mode

## Running in Docker

### Development

You may want to do all your development in docker and keep dependencies locked for the whole team, we
added a `Dockerfile.dev` and `docker-compose.yml` so you can build one and run many instances:

```sh
docker-compose build
docker-compose up
```

Application will be proxied by `nginx` you can browse the app at `http://localhost/`, you can turn the app
off by running:

```sh
docker-compose down
```

### Production

Another way to run the app in production is to use docker just try the following:

```sh
Expand Down
18 changes: 18 additions & 0 deletions config/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
server {
listen 80;
listen [::]:80;

server_name web.dev;

location / {
resolver web valid=30s;
proxy_pass http://web:8080/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}

# vim: set ft=nginx:
23 changes: 23 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: "3.1"
services:
proxy:
image: "nginx:alpine"
command: ["nginx", "-g", "daemon off;"]
ports:
- 80:80
environment:
- NGINX_HOST=web.dev
- NGINX_PORT=80
volumes:
- ./config/nginx.conf:/etc/nginx/conf.d/default.conf
depends_on:
- web

web:
build:
context: .
dockerfile: Dockerfile.dev
command: "npm start"
image: "web-dev:dev"
volumes:
- ./:/opt/src