diff --git a/Dockerfile b/Dockerfile index 5ecd426..92bee7c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,9 @@ -FROM node:7 -ENV IS_DOCKER 1 -RUN env +FROM node +WORKDIR /app +ADD . /app/ RUN apt-get update RUN apt-get install nasm -RUN npm install webpack -g -WORKDIR /tmp -COPY package.json /tmp/ -RUN npm config set registry http://registry.npmjs.org/ && npm install - -WORKDIR /code -COPY . /code/ -RUN cp -a /tmp/node_modules /code/ -RUN webpack - -EXPOSE 3000 +RUN npm ci +CMD ["npm", "start"] +EXPOSE 8080 \ No newline at end of file diff --git a/configs/webpack/dev.js b/configs/webpack/dev.js index 4977852..8d9e94e 100644 --- a/configs/webpack/dev.js +++ b/configs/webpack/dev.js @@ -9,7 +9,7 @@ module.exports = merge(commonConfig, { mode: "development", entry: [ "react-hot-loader/patch", // Activate HMR for React - "webpack-dev-server/client?http://localhost:8080", // Bundle the client for webpack-dev-server and connect to the provided endpoint + "webpack-dev-server/client?http://0.0.0.0:8080", // Bundle the client for webpack-dev-server and connect to the provided endpoint "webpack/hot/only-dev-server", // Bundle the client for hot reloading, only- means to only hot reload for successful updates "./index.tsx" // The entry point of our app ], diff --git a/docker-compose.yml b/docker-compose.yml index b823567..cc7e8ca 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,8 +4,7 @@ services: web-frontend: build: . image: git.sahkoinsinoorikilta.fi:4567/vtmk/web2.0-frontend - # Before you run this file for the first time, make sure - # you remove node_modules/ folders in your host machine - command: ["bash", "-c", "if test -d node_modules; then echo node_modules_exists; else cp -a /tmp/node_modules /code; fi && cd /code && npm install && npm start"] ports: - - "3000:3000" + - "3000:8080" + volumes: + - ./src:/app/src