SliverHorn
4 years ago
7 changed files with 105 additions and 13 deletions
-
12README-zh_CN.md
-
17README.md
-
31docker-compose.yaml
-
47dockerfile_server
-
6server/config.yaml
-
1server/core/server.go
-
2web/.env.production
@ -0,0 +1,31 @@ |
|||
version: "3.8" |
|||
|
|||
services: |
|||
server: |
|||
build: |
|||
context: ./ |
|||
dockerfile: ./dockerfile_server |
|||
container_name: gva-server # 容器名 |
|||
restart: always |
|||
ports: |
|||
- '8888:8888' |
|||
depends_on: |
|||
- mysql |
|||
- redis |
|||
|
|||
mysql: |
|||
image: registry.cn-shanghai.aliyuncs.com/gva/gva-mysql:1.1 |
|||
container_name: gva-mysql |
|||
command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci #设置utf8字符集 |
|||
restart: always |
|||
ports: |
|||
- "3306:3306" # host物理直接映射端口为6606 |
|||
environment: |
|||
MYSQL_ROOT_PASSWORD: "Aa@6447985" # root管理员用户密码 |
|||
|
|||
redis: |
|||
image: redis:6.0.6 |
|||
container_name: gva-redis # 容器名 |
|||
restart: always |
|||
ports: |
|||
- '6379:6379' |
@ -0,0 +1,47 @@ |
|||
FROM node:12.16.1 as gva-web |
|||
|
|||
WORKDIR /gva_web/ |
|||
COPY web/ . |
|||
RUN npm install -g cnpm --registry=https://registry.npm.taobao.org |
|||
RUN cnpm install || npm install |
|||
RUN npm run build |
|||
|
|||
FROM golang:alpine as gva-server |
|||
|
|||
ENV GO111MODULE=on |
|||
ENV GOPROXY=https://goproxy.io,direct |
|||
WORKDIR /go/src/gin-vue-admin |
|||
COPY server/ ./ |
|||
RUN go env && go list && go build -o gva-server . |
|||
|
|||
|
|||
FROM nginx:alpine |
|||
LABEL MAINTAINER="SliverHorn" |
|||
|
|||
WORKDIR gva/ |
|||
|
|||
# copy web |
|||
COPY --from=gva-web /gva_web/dist ./resource/dist |
|||
# copy server |
|||
COPY --from=gva-server /go/src/gin-vue-admin/gva-server ./ |
|||
COPY --from=gva-server /go/src/gin-vue-admin/config.yaml ./ |
|||
COPY --from=gva-server /go/src/gin-vue-admin/resource ./resource |
|||
|
|||
|
|||
EXPOSE 8888 |
|||
|
|||
ENTRYPOINT ./gva-server |
|||
|
|||
# 根据Dockerfile生成Docker镜像 |
|||
|
|||
# docker build -t gva-server:1.0 . |
|||
|
|||
#- 根据Docker镜像启动Docker容器 |
|||
# - 后台运行 |
|||
# - ``` |
|||
# docker run -d -p 8888:8888 --name gva-server-v1 gva-server:1.0 |
|||
# ``` |
|||
# - 以可交互模式运行, Ctrl + p + q |
|||
# - ``` |
|||
# docker run -it -p 8888:8888 --name gva-server-v1 gva-server:1.0 |
|||
# ``` |
@ -1,2 +1,2 @@ |
|||
ENV = 'production' |
|||
VUE_APP_BASE_API = '/v1' |
|||
VUE_APP_BASE_API = '' |
Write
Preview
Loading…
Cancel
Save
Reference in new issue