From a82b3a6b242dc6c74b4b024f76fc04fdee3beb4f Mon Sep 17 00:00:00 2001 From: Alex Mikhalev Date: Wed, 25 Jul 2018 13:50:31 -0600 Subject: [PATCH] Added development mode for webpack --- .dockerignore | 3 +++ Dockerfile | 1 + Dockerfile.dev | 16 ++++++++++++++++ README.md | 0 app/webpack.config.js | 1 + docker-compose.dev.yml | 29 +++++++++++++++++++++++++++++ 6 files changed, 50 insertions(+) create mode 100644 Dockerfile.dev create mode 100644 README.md create mode 100644 docker-compose.dev.yml diff --git a/.dockerignore b/.dockerignore index a9dde4a..e445644 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,6 @@ .git .vscode node_modules +build +dist +public diff --git a/Dockerfile b/Dockerfile index 36e7d7d..ddf48c3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,4 +29,5 @@ COPY --from=builder /app/dist ./dist COPY --from=builder /app/public ./public EXPOSE 8080 +EXPOSE 8081 ENTRYPOINT [ "npm", "run", "start" ] diff --git a/Dockerfile.dev b/Dockerfile.dev new file mode 100644 index 0000000..454ad54 --- /dev/null +++ b/Dockerfile.dev @@ -0,0 +1,16 @@ +FROM node:alpine + +RUN apk add yarn \ + python \ + make \ + g++ + +WORKDIR /app/ + +COPY package.json yarn.lock /app/ +RUN yarn install --frozen-lockfile + +COPY tslint.json /app + +EXPOSE 8080 +ENTRYPOINT [ "npm", "run", "start:dev" ] diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/app/webpack.config.js b/app/webpack.config.js index 177e22f..e48e99d 100644 --- a/app/webpack.config.js +++ b/app/webpack.config.js @@ -246,6 +246,7 @@ const getConfig = module.exports = (env) => { devServer: { hot: true, historyApiFallback: true, + host: "0.0.0.0", port: 8081, proxy: [{ context: ["/api"], // TODO: update when there is actually an api diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml new file mode 100644 index 0000000..852b8ca --- /dev/null +++ b/docker-compose.dev.yml @@ -0,0 +1,29 @@ +version: "3" +services: + web: + image: "amikhalev/sprinklers3:dev" + build: + context: . + dockerfile: Dockerfile.dev + ports: + - "8080:8080" + - "8081:8081" + volumes: + - ./app:/app/app + - ./common:/app/common + - ./server:/app/server + env_file: + - .env + environment: + - PORT=8080 + - TYPEORM_CONNECTION=postgres + - TYPEORM_HOST=database + - TYPEORM_DATABASE=postgres + - TYPEORM_USERNAME=postgres + - TYPEORM_PASSWORD=8JN4w0UsN5dbjMjNvPe452P2yYOqg5PV + # Must specify JWT_SECRET and MQTT_URL + + database: + image: "postgres:11-alpine" + environment: + - POSTGRES_PASSWORD=8JN4w0UsN5dbjMjNvPe452P2yYOqg5PV \ No newline at end of file