Skip to content
This repository has been archived by the owner on Jul 3, 2020. It is now read-only.

Commit

Permalink
Got FE hot reloading working
Browse files Browse the repository at this point in the history
  • Loading branch information
adaam2 committed Mar 4, 2018
1 parent 9dd9397 commit 277339d
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 22 deletions.
9 changes: 8 additions & 1 deletion config/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,17 @@ server {

# Other to frontend
location /sockjs-node {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;

proxy_pass http://frontend:4000;

proxy_redirect off;

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://frontend:80;
}

location / {
Expand Down
11 changes: 8 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ services:
- ./config/nginx:/bitnami/nginx/conf/vhosts
depends_on:
- backend
- frontend
environment:
- VIRTUAL_HOST=yourproject.docker
- VIRTUAL_PORT=8080
Expand All @@ -27,10 +28,14 @@ services:
ports:
- "3000:3000"
frontend:
build: frontend
build:
context: ./frontend/
depends_on:
- backend
command: npm start
volumes:
- '/frontend/src:/usr/src/frontend-app/src'
- '/frontend/public:/usr/src/frontend-app/public'
- ./frontend/:/usr/src/frontend-app
- /usr/src/frontend-app/node_modules
ports:
- "35729:35729"
- "4000:4000"
Expand Down
4 changes: 3 additions & 1 deletion frontend/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.git
.idea
node_modules
build
build
npm-debug.log*
npm-error.log*
18 changes: 7 additions & 11 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
FROM node:latest
FROM node:9.4.0

ADD yarn.lock /yarn.lock
ADD package.json /package.json
WORKDIR /usr/src/frontend-app

ENV NODE_PATH=/node_modules
ENV PATH=$PATH:/node_modules/.bin
RUN yarn
COPY package*.json ./

WORKDIR /app
ADD . /app
RUN npm install -qy

COPY . .

EXPOSE 3000
EXPOSE 35729

ENTRYPOINT ["/bin/bash", "/app/run.sh"]
CMD ["start"]
CMD ["npm", "start"]
5 changes: 0 additions & 5 deletions frontend/run.sh

This file was deleted.

7 changes: 6 additions & 1 deletion frontend/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@ class App extends Component {
return (
<div className="App">
<header className="App-header">
<h1>
Hello world
</h1>
</header>

<p>
Build something cool!
</p>
</div>
);
}
Expand Down

0 comments on commit 277339d

Please sign in to comment.