添加dockerfile
This commit is contained in:
9
Dockerfile
Normal file
9
Dockerfile
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
FROM ubuntu:latest
|
||||||
|
|
||||||
|
LABEL authors="Endera"
|
||||||
|
|
||||||
|
EXPOSE 8081
|
||||||
|
|
||||||
|
COPY prepare.sh /root/prepare.sh
|
||||||
|
|
||||||
|
ENTRYPOINT ["bash", "/root/prepare.sh"]
|
||||||
26
prepare.sh
Normal file
26
prepare.sh
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
cd ~
|
||||||
|
|
||||||
|
bash -c "cat << EOF > /etc/apt/sources.list && apt update
|
||||||
|
deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
|
||||||
|
deb-src http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
|
||||||
|
deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
|
||||||
|
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
|
||||||
|
deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
|
||||||
|
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
|
||||||
|
deb http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
|
||||||
|
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
|
||||||
|
deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
|
||||||
|
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
|
||||||
|
EOF"
|
||||||
|
|
||||||
|
apt install sudo git wget openjdk-17-jdk -y
|
||||||
|
|
||||||
|
git config --global user.name "EnderByEndera"
|
||||||
|
git config --global user.password "8Bs8hxHtE-iq44g"
|
||||||
|
|
||||||
|
git clone https://git.mesalab.cn/EnderByEndera/realtime_protection.git
|
||||||
|
|
||||||
|
cd realtime_protection
|
||||||
|
./gradlew clean && ./gradlew bootJar
|
||||||
84
src/main/resources/nginx/nginx.conf
Normal file
84
src/main/resources/nginx/nginx.conf
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
user root root;
|
||||||
|
worker_processes auto;
|
||||||
|
pid /run/nginx.pid;
|
||||||
|
include /etc/nginx/modules-enabled/*.conf;
|
||||||
|
|
||||||
|
events {
|
||||||
|
worker_connections 768;
|
||||||
|
# multi_accept on;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
|
||||||
|
##
|
||||||
|
# Basic Settings
|
||||||
|
##
|
||||||
|
|
||||||
|
sendfile on;
|
||||||
|
tcp_nopush on;
|
||||||
|
types_hash_max_size 2048;
|
||||||
|
# server_tokens off;
|
||||||
|
|
||||||
|
# server_names_hash_bucket_size 64;
|
||||||
|
# server_name_in_redirect off;
|
||||||
|
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
|
||||||
|
##
|
||||||
|
# SSL Settings
|
||||||
|
##
|
||||||
|
|
||||||
|
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
|
||||||
|
ssl_prefer_server_ciphers on;
|
||||||
|
|
||||||
|
##
|
||||||
|
# Logging Settings
|
||||||
|
##
|
||||||
|
|
||||||
|
access_log /var/log/nginx/access.log;
|
||||||
|
error_log /var/log/nginx/error.log;
|
||||||
|
|
||||||
|
##
|
||||||
|
# Gzip Settings
|
||||||
|
##
|
||||||
|
|
||||||
|
gzip on;
|
||||||
|
|
||||||
|
# gzip_vary on;
|
||||||
|
# gzip_proxied any;
|
||||||
|
# gzip_comp_level 6;
|
||||||
|
# gzip_buffers 16 8k;
|
||||||
|
# gzip_http_version 1.1;
|
||||||
|
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
||||||
|
|
||||||
|
##
|
||||||
|
# Virtual Host Configs
|
||||||
|
##
|
||||||
|
|
||||||
|
include /etc/nginx/conf.d/*.conf;
|
||||||
|
include /etc/nginx/sites-enabled/*;
|
||||||
|
include /home/wzw/nginx/configs/*.conf;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#mail {
|
||||||
|
# # See sample authentication script at:
|
||||||
|
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
|
||||||
|
#
|
||||||
|
# # auth_http localhost/auth.php;
|
||||||
|
# # pop3_capabilities "TOP" "USER";
|
||||||
|
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
|
||||||
|
#
|
||||||
|
# server {
|
||||||
|
# listen localhost:110;
|
||||||
|
# protocol pop3;
|
||||||
|
# proxy on;
|
||||||
|
# }
|
||||||
|
#
|
||||||
|
# server {
|
||||||
|
# listen localhost:143;
|
||||||
|
# protocol imap;
|
||||||
|
# proxy on;
|
||||||
|
# }
|
||||||
|
#}
|
||||||
BIN
src/main/resources/static/favicon.ico
Normal file
BIN
src/main/resources/static/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
47
src/main/resources/static/test.html
Normal file
47
src/main/resources/static/test.html
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>cors test</title>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
|
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container" align="center">
|
||||||
|
<h1>Cors Test</h1><br/>
|
||||||
|
<p>input your target api address:</p>
|
||||||
|
<input type="text" style="width:600px;height:30px;font-size:14px;" id="urlText"/><br/><br/><br/>
|
||||||
|
<p>input your token:</p>
|
||||||
|
<input type="text" style="width:600px;height:30px;font-size:14px;" id="tokenTxt" value=""/><br/><br/>
|
||||||
|
<input type="button" class="btn btn-outline-primary" id="cors" value="CHECK CORS"/>
|
||||||
|
</div>
|
||||||
|
<!-- Optional JavaScript -->
|
||||||
|
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||||
|
<script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||||
|
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
$("#cors").on('click', function (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
var url2 = $("#urlText").val();
|
||||||
|
$.get({
|
||||||
|
contentType: 'application/json;charset=UTF-8',
|
||||||
|
url: url2,
|
||||||
|
beforeSend: function (xhr) {
|
||||||
|
|
||||||
|
if ($("#tokenTxt").val().trim()) {
|
||||||
|
/* Authorization header */
|
||||||
|
xhr.setRequestHeader("token", ""+ $("#tokenTxt").val());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
success: function (data) {
|
||||||
|
alert("success");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user