Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Chatopera OpenSource
/
ferry_web
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
0f10f03c
authored
Apr 13, 2021
by
KagurazakaNyaa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改docker构建方式
parent
a4c92dc9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
178 additions
and
2 deletions
Dockerfile
docker/entrypoint.sh
docker/nginx.conf
Dockerfile
View file @
0f10f03c
...
...
@@ -9,6 +9,11 @@ RUN npm run build:prod
FROM
nginx:1.18.0
COPY
--from=builder /opt/ferry_web/web /opt/web
COPY
docker/nginx.conf /etc/nginx/nginx.conf
COPY
docker/entrypoint.sh /entrypoint.sh
ENV
LISTEN_DOMAIN=fdevops.com
#暴露容器8001端口
EXPOSE
8001
\ No newline at end of file
EXPOSE
8001
ENTRYPOINT
[ "/entrypoint.sh" ]
\ No newline at end of file
docker/entrypoint.sh
0 → 100755
View file @
0f10f03c
#!/bin/sh
# vim:sw=4:ts=4:et
grep
-r
-o
"http://fdevops.com:8001"
/opt/web |awk
-F
':'
'{print $1}'
| xargs sed
-i
s
"#http://fdevops.com:8001#http://
${
LISTEN_DOMAIN
}
:8001#g"
grep
-r
-o
"VUE_APP_BASE_API"
/opt/web |awk
-F
':'
'{print $1}'
| xargs sed
-i
s
"#VUE_APP_BASE_API#http://
${
LISTEN_DOMAIN
}
:8001#g"
grep
-r
-o
"localhost"
/opt/web/static/web/js |awk
-F
':'
'{print $1}'
| xargs sed
-i
s
"#localhost#
${
LISTEN_DOMAIN
}
#g"
grep
-r
-o
"fdevops.com"
/opt/web/static/web/js |awk
-F
':'
'{print $1}'
| xargs sed
-i
s
"#fdevops.com#
${
LISTEN_DOMAIN
}
#g"
set
-e
if
[
-z
"
${
NGINX_ENTRYPOINT_QUIET_LOGS
:-}
"
]
;
then
exec
3>&1
else
exec
3>/dev/null
fi
if
[
"
$1
"
=
"nginx"
-o
"
$1
"
=
"nginx-debug"
]
;
then
if
/usr/bin/find
"/docker-entrypoint.d/"
-mindepth
1
-maxdepth
1
-type
f
-print
-quit
2>/dev/null |
read
v
;
then
echo
>
&3
"
$0
: /docker-entrypoint.d/ is not empty, will attempt to perform configuration"
echo
>
&3
"
$0
: Looking for shell scripts in /docker-entrypoint.d/"
find
"/docker-entrypoint.d/"
-follow
-type
f
-print
| sort
-n
|
while
read
-r
f
;
do
case
"
$f
"
in
*
.sh
)
if
[
-x
"
$f
"
]
;
then
echo
>
&3
"
$0
: Launching
$f
"
;
"
$f
"
else
# warn on shell scripts without exec bit
echo
>
&3
"
$0
: Ignoring
$f
, not executable"
;
fi
;;
*
)
echo
>
&3
"
$0
: Ignoring
$f
"
;;
esac
done
echo
>
&3
"
$0
: Configuration complete; ready for start up"
else
echo
>
&3
"
$0
: No files found in /docker-entrypoint.d/, skipping configuration"
fi
fi
nginx
-g
"daemon off;"
\ No newline at end of file
docker/nginx.conf
0 → 100644
View file @
0f10f03c
user
nginx
;
worker_processes
auto
;
error_log
/var/log/nginx/error.log
warn
;
pid
/var/run/nginx.pid
;
worker_rlimit_nofile
51200
;
events
{
use
epoll
;
worker_connections
51200
;
multi_accept
on
;
}
http
{
include
mime.types
;
default_type
application/octet-stream
;
server_names_hash_bucket_size
128
;
client_header_buffer_size
32k
;
large_client_header_buffers
4
32k
;
client_max_body_size
1024m
;
client_body_buffer_size
10m
;
sendfile
on
;
tcp_nopush
on
;
keepalive_timeout
120
;
server_tokens
off
;
tcp_nodelay
on
;
fastcgi_connect_timeout
300
;
fastcgi_send_timeout
300
;
fastcgi_read_timeout
300
;
fastcgi_buffer_size
64k
;
fastcgi_buffers
4
64k
;
fastcgi_busy_buffers_size
128k
;
fastcgi_temp_file_write_size
128k
;
fastcgi_intercept_errors
on
;
#Gzip Compression
gzip
on
;
gzip_buffers
16
8k
;
gzip_comp_level
6
;
gzip_http_version
1
.1
;
gzip_min_length
256
;
gzip_proxied
any
;
gzip_vary
on
;
gzip_types
text/xml
application/xml
application/atom
+xml
application/rss
+xml
application/xhtml
+xml
image/svg
+xml
text/javascript
application/javascript
application/x-javascript
text/x-json
application/json
application/x-web-app-manifest
+json
text/css
text/plain
text/x-component
font/opentype
application/x-font-ttf
application/vnd
.ms-fontobject
image/x-icon
;
gzip_disable
"MSIE
[1-6]
\
.(?!.*SV1)"
;
proxy_ignore_client_abort
on
;
server
{
listen
8001
;
# 监听端口
# server_name -; # 域名可以有多个,用空格隔开
#charset koi8-r;
#access_log logs/host.access.log main;
location
/
{
root
/opt/web
;
index
index.html
index.htm
;
#目录内的默认打开文件,如果没有匹配到index.html,则搜索index.htm,依次类推
}
#ssl配置省略
location
/api
{
# rewrite ^.+api/?(.*)$ /$1 break;
proxy_pass
http://ferry_backend:8002
;
#node api server 即需要代理的IP地址
proxy_redirect
off
;
proxy_set_header
Host
$host
:
$server_port
;
proxy_set_header
X-Real-IP
$remote_addr
;
proxy_set_header
X-Forwarded-For
$proxy_add_x_forwarded_for
;
}
# 登陆
location
/login
{
proxy_pass
http://ferry_backend:8002
;
#node api server 即需要代理的IP地址
proxy_redirect
off
;
proxy_ignore_client_abort
on
;
proxy_max_temp_file_size
256m
;
proxy_connect_timeout
90
;
proxy_send_timeout
90
;
proxy_read_timeout
90
;
proxy_buffer_size
4k
;
proxy_buffers
4
32k
;
proxy_busy_buffers_size
32k
;
proxy_temp_file_write_size
64k
;
proxy_http_version
1
.1
;
proxy_set_header
Connection
""
;
proxy_set_header
Host
$host
:
$server_port
;
proxy_set_header
X-Real-IP
$remote_addr
;
proxy_set_header
X-Forwarded-For
$proxy_add_x_forwarded_for
;
}
# 刷新token
location
/refresh_token
{
proxy_pass
http://ferry_backend:8002
;
#node api server 即需要代理的IP地址
proxy_set_header
Host
$host
:
$server_port
;
}
# 接口地址
location
/swagger
{
proxy_pass
http://ferry_backend:8002
;
#node api server 即需要代理的IP地址
proxy_set_header
Host
$host
:
$server_port
;
}
# 后端静态文件路径
location
/static/uploadfile
{
proxy_pass
http://ferry_backend:8002
;
#node api server 即需要代理的IP地址
proxy_set_header
Host
$host
:
$server_port
;
}
#error_page 404 /404.html; #对错误页面404.html 做了定向配置
# redirect server error pages to the static page /50x.html
#将服务器错误页面重定向到静态页面/50x.html
#
error_page
500
502
503
504
/50x.html
;
location
=
/50x.html
{
root
html
;
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment