Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 372a2d3

Browse files
committed
docker
2 parents 7a0b063 + a23aa77 commit 372a2d3

File tree

6 files changed

+63
-9
lines changed

6 files changed

+63
-9
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ assets
1010
*.o
1111
*.a
1212
*.so
13+
docker

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,6 @@ welcome.png
5252
ssl
5353
bin
5454
tmp
55+
docker
5556

5657
*.code-workspace

Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# Start from golang v1.12 base image
2-
FROM golang:1.12
1+
# Start from golang v1.17 base image
2+
FROM golang:1.17
33

44
WORKDIR /app/studygolang
55

6-
COPY . /app/studygolang
6+
COPY . /app/studygolang/
77

8-
RUN make build
8+
RUN make
99

10-
CMD ["bin/studygolang"]
10+
ENTRYPOINT ["bin/studygolang", "-embed_crawler", "-embed_indexing"]

config/db.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ CREATE TABLE `interview_question` (
845845
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增id',
846846
`sn` bigint unsigned NOT NULL DEFAULT 0 COMMENT '题目序号,程序生成',
847847
`question` varchar(1022) NOT NULL DEFAULT '' COMMENT '问题',
848-
`answer` varchar(4094) NOT NULL DEFAULT '' COMMENT '答案',
848+
`answer` text NOT NULL COMMENT '答案',
849849
`level` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '问题难易级别:0-低;1-中;2-高',
850850
`viewnum` int unsigned NOT NULL DEFAULT 0 COMMENT '浏览数',
851851
`cmtnum` int unsigned NOT NULL DEFAULT 0 COMMENT '评论数',

docker-compose.yml

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,62 @@ services:
1010
networks:
1111
- default
1212
- app_net
13+
depends_on:
14+
- mysql
15+
- redis
1316
external_links:
1417
- redis:redis
1518
- mysql:mysql
1619
volumes:
17-
- ./static:/app/studygolang/static
18-
- ./template:/app/studygolang/template
19-
- ./log:/app/studygolang/log
20+
- ./static:/data/www/studygolang/static
21+
- ./template:/data/www/studygolang/template
22+
- ./config:/data/www/studygolang/config
23+
- ./log:/data/www/studygolang/log
24+
restart: always
25+
nginx:
26+
container_name: nginx
27+
build: ./nginx
28+
depends_on:
29+
- play
30+
links:
31+
- play:play
32+
volumes:
33+
- /data/www:/data/www:rw
34+
- ./nginx/conf.d:/etc/nginx/conf.d:ro
35+
- ./nginx/certs/:/etc/nginx/certs
36+
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
37+
- ./logs/nginx:/var/log/nginx:rw
38+
ports:
39+
- "80:80"
40+
- "443:443"
41+
restart: always
42+
command: nginx -g 'daemon off;'
43+
mysql:
44+
container_name: mysql
45+
image: "mysql/mysql-server:5.7"
46+
networks:
47+
- default
48+
- app_net
49+
ports:
50+
- "3306:3306"
51+
- "33060:33060"
52+
environment:
53+
- MYSQL_ROOT_PASSWORD=123456
54+
volumes:
55+
- ./docker/mysql:/var/lib/mysql
56+
restart: always
57+
58+
redis:
59+
container_name: redis
60+
image: "redis:6.2"
61+
networks:
62+
- default
63+
- app_net
64+
ports:
65+
- "6379:6379"
66+
volumes:
67+
- ./docker/redis:/usr/local/etc/redis
68+
restart: always
2069

2170
networks:
2271
app_net:

template/interview/question.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ <h3>答案解析:</h3>
102102
"/rank/view"
103103
];
104104

105+
var keyprefix = 'interview';
106+
var objid = {{.question.Id}};
107+
105108
$(function(){
106109
loadComments();
107110

0 commit comments

Comments
 (0)