Browse Source

update Dockerfile

Alenx 6 years ago
parent
commit
489b5a0a33
5 changed files with 34 additions and 184 deletions
  1. 0 56
      docker-compose-dev.yml
  2. 0 63
      docker-compose.pro.yml
  3. 34 30
      docker-compose.yml
  4. 0 30
      fe/Dockerfile
  5. 0 5
      gateway/Dockerfile

+ 0 - 56
docker-compose-dev.yml

@@ -1,56 +0,0 @@
-version: '3.7'
-services:
-  web:
-    image: nginx
-    container_name: walle-nginx
-    hostname: nginx-web
-    ports:
-      - "80:80"
-    volumes:
-      - ./fe/:/data/web/:ro
-      - ./gateway/nginx/:/etc/nginx/conf.d/:ro
-
-  python:
-    image: ./
-    container_name: walle-python
-    depends_on:
-      - db
-    links:
-      - db
-    expose:
-      - "5000"
-    volumes:
-      - /opt/walle:/opt/walle
-    networks:
-      - walle-net
-    restart: always
-
-  db:
-    image: mysql
-    container_name: walle-mysql
-    ports:
-      - "3306:3306"
-    expose:
-      - "3306"
-    command: --default-authentication-plugin=mysql_native_password
-    environment:
-      MYSQL_ROOT_PASSWORD: Walle2099.
-      MYSQL_DATABASE: walle
-    volumes:
-      - /data/walle/mysql:/var/lib/mysql
-    networks:
-      - walle-net
-    restart: always
-
-  adminer:
-    image: adminer
-    container_name: walle-adminer
-    ports:
-      - "8888:8080"
-    networks:
-      - walle-net
-    restart: always
-
-networks:
-  walle-net:
-    driver: bridge

+ 0 - 63
docker-compose.pro.yml

@@ -1,63 +0,0 @@
-# 用户使用,最终镜像
-
-version: "3.7"
-
-services:
-
-  db:
-    image: mysql
-    ports:
-      - 0.0.0.0:3306:3306
-    expose:
-      - 3306
-    command: --default-authentication-plugin=mysql_native_password
-    environment:
-      MYSQL_ROOT_PASSWORD: walle
-      MYSQL_DATABASE: walle
-    volumes:
-      - /data/walle/mysql:/var/lib/mysql
-    networks:
-      - walle-net
-    restart: always
-
-  adminer:
-    image: adminer
-    ports:
-      - 8888:8080
-    networks:
-      - walle-net
-    restart: always
-
-
-  ui:
-    image: walle/walle-ui:latest
-    expose:
-      - 8000
-    networks:
-      - walle-net
-    restart: always
-
-  web:
-    image: walle/walle-api:latest
-    depends_on:
-      - db
-    expose:
-      - 5000
-    environment:
-      - WALLE_SECRET="guess me out"
-    networks:
-      - walle-net
-    restart: always
-
-  gateway:
-    image: walle/walle-gateway:latest
-    ports:
-      - 0.0.0.0:80:80
-    volumes:
-      - ./fe/:/data/web/:ro
-    networks:
-      walle-net:
-    restart: always
-
-networks:
-  walle-net: ~

+ 34 - 30
docker-compose.yml

@@ -1,13 +1,37 @@
-version: "3.7"
-
+version: '3.7'
 services:
+  web:
+    image: nginx
+    container_name: walle-nginx
+    hostname: nginx-web
+    ports:
+      - "80:80"
+    volumes:
+      - ./fe/:/data/web/:ro
+      - ./gateway/nginx/:/etc/nginx/conf.d/:ro
+
+  python:
+    build: ./
+    container_name: walle-python
+    depends_on:
+      - db
+    links:
+      - db
+    expose:
+      - "5000"
+    volumes:
+      - /opt/walle:/opt/walle
+    networks:
+      - walle-net
+    restart: always
 
   db:
     image: mysql
+    container_name: walle-mysql
     ports:
-      - 0.0.0.0:3306:3306
+      - "3306:3306"
     expose:
-      - 3306
+      - "3306"
     command: --default-authentication-plugin=mysql_native_password
     environment:
       MYSQL_ROOT_PASSWORD: walle
@@ -20,35 +44,15 @@ services:
 
   adminer:
     image: adminer
-    ports:
-      - 8888:8080
-    networks:
-      - walle-net
-    restart: always
-
-  web:
-    build: ./
-    depends_on:
+    container_name: walle-adminer
+    links:
       - db
-    expose:
-      - 5000
-    environment:
-      - WALLE_SECRET="guess me out"
-    networks:
-      - walle-net
-    restart: always
-
-
-  gateway:
-    image: nginx
     ports:
-      - 0.0.0.0:80:80
-    volumes:
-      - ./fe/:/data/web/:ro
-      - ./gateway/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
+      - "8888:8080"
     networks:
-      walle-net:
+      - walle-net
     restart: always
 
 networks:
-  walle-net: ~
+  walle-net:
+    driver: bridge

+ 0 - 30
fe/Dockerfile

@@ -1,30 +0,0 @@
-# 看不懂的学习一下docker的多阶段构建
-# STEP 1: Build
-FROM node:9 as builder
-
-WORKDIR /usr/src/app
-
-COPY package.json  ./
-RUN npm config set registry https://registry.npm.taobao.org  && npm i
-COPY . .
-
-# todo 谁来把这里调试通过一下
-RUN npm run build
-
-# STEP 2: Setup
-FROM nginx
-
-ENV NGINX_PORT 8000
-
-RUN rm -rf /usr/share/nginx/html/*
-#COPY --from=builder /usr/src/app/avatar /usr/share/nginx/html
-#COPY --from=builder /usr/src/app/public /usr/share/nginx/html
-#COPY --from=builder /usr/src/app/static /usr/share/nginx/html
-#COPY --from=builder /usr/src/app/favicon.ico /usr/share/nginx/html
-#COPY --from=builder /usr/src/app/index.html /usr/share/nginx/html
-#COPY --from=builder /usr/src/app/socket.io.min.js /usr/share/nginx/html
-
-# todo 上边到逻辑走不通,先直接复制目录
-COPY . .
-
-CMD [ "nginx", "-g", "daemon off;"]

+ 0 - 5
gateway/Dockerfile

@@ -1,5 +0,0 @@
-FROM nginx
-
-COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf
-
-CMD [ "nginx", "-g", "daemon off;"]