From bedf287d251f9a9c951e4025c17f41f1a7069cd5 Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Sat, 29 Sep 2018 11:27:06 +0100 Subject: [PATCH] Add Docker support (#2430) * add dockerfile * add development dockerfile * add development docker-compose file * add docker-compose file * add nginx config * move dockerfiles to their own directory * move nginx config to docker --- docker/Dockerfile | 13 +++++++++++++ docker/Dockerfile.dev | 10 ++++++++++ docker/docker-compose.dev.yml | 12 ++++++++++++ docker/docker-compose.yml | 19 +++++++++++++++++++ docker/nginx.conf | 9 +++++++++ 5 files changed, 63 insertions(+) create mode 100644 docker/Dockerfile create mode 100644 docker/Dockerfile.dev create mode 100644 docker/docker-compose.dev.yml create mode 100644 docker/docker-compose.yml create mode 100644 docker/nginx.conf diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 00000000..54e1a4a7 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,13 @@ +FROM node:latest + +WORKDIR /usr/src/app/ + +COPY package.json ./ +RUN npm install --silent --no-cache + +COPY ./ ./ + +RUN sh ./tests/fix_puppeteer.sh +RUN npm run test:all + +CMD ["npm", "run", "build"] diff --git a/docker/Dockerfile.dev b/docker/Dockerfile.dev new file mode 100644 index 00000000..fdbb0e00 --- /dev/null +++ b/docker/Dockerfile.dev @@ -0,0 +1,10 @@ +FROM node:latest + +WORKDIR /usr/src/app/ + +COPY package.json ./ +RUN npm install --silent --no-cache + +COPY ./ ./ + +CMD ["npm", "run", "start"] diff --git a/docker/docker-compose.dev.yml b/docker/docker-compose.dev.yml new file mode 100644 index 00000000..d206d872 --- /dev/null +++ b/docker/docker-compose.dev.yml @@ -0,0 +1,12 @@ +version: "3.5" + +services: + ant-design-pro_dev: + build: + context: ./ + dockerfile: Dockerfile.dev + container_name: "ant-design-pro_dev" + volumes: + - ./src:/usr/src/app/src + - ./config:/usr/src/app/config + - ./mock:/usr/src/app/mock diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 00000000..fa849a04 --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,19 @@ +version: "3.5" + +services: + ant-design-pro_build: + build: ./ + container_name: "ant-design-pro_build" + volumes: + - dist:/usr/src/app/dist + + ant-design-pro_web: + image: nginx + container_name: "ant-design-pro_web" + restart: unless-stopped + volumes: + - dist:/usr/share/nginx/html:ro + - ./nginx.conf:/etc/nginx/conf.d/default.conf + +volumes: + dist: diff --git a/docker/nginx.conf b/docker/nginx.conf new file mode 100644 index 00000000..38c7f17b --- /dev/null +++ b/docker/nginx.conf @@ -0,0 +1,9 @@ +server { + listen 80; + + root /usr/share/nginx/html; + + location / { + try_files $uri $uri/ /index.html; + } +} -- GitLab