mirror of
				https://github.com/TeaOSLab/EdgeAdmin.git
				synced 2025-11-04 21:35:33 +08:00 
			
		
		
		
	增加Docker镜像构建脚本
This commit is contained in:
		
							
								
								
									
										1
									
								
								docker/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								docker/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					*.zip
 | 
				
			||||||
							
								
								
									
										35
									
								
								docker/Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								docker/Dockerfile
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,35 @@
 | 
				
			|||||||
 | 
					FROM alpine:edge
 | 
				
			||||||
 | 
					LABEL maintainer="iwind.liu@gmail.com"
 | 
				
			||||||
 | 
					ENV TZ "Asia/Shanghai"
 | 
				
			||||||
 | 
					ENV VERSION 0.5.7
 | 
				
			||||||
 | 
					ENV ROOT_DIR /usr/local/goedge
 | 
				
			||||||
 | 
					ENV TAR_FILE edge-admin-linux-amd64-plus-v${VERSION}.zip
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RUN apk add --no-cache tzdata
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RUN mkdir ${ROOT_DIR};
 | 
				
			||||||
 | 
					COPY ${TAR_FILE} ${ROOT_DIR}/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RUN apk add unzip; \
 | 
				
			||||||
 | 
					    cd ${ROOT_DIR}; \
 | 
				
			||||||
 | 
						unzip ${ROOT_DIR}/${TAR_FILE}; \
 | 
				
			||||||
 | 
					    rm -f ${ROOT_DIR}/${TAR_FILE};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RUN apk add mysql mysql-client; \
 | 
				
			||||||
 | 
						sed -e "s/\[mysqld\]/\[mysqld\]\n\ndatadir=\/var\/lib\/mysql\nport=3306\ninnodb_flush_log_at_trx_commit=2\nmax_connections=256\nmax_prepared_stmt_count=65535\nbinlog_cache_size=1M\nbinlog_stmt_cache_size=1M\nthread_cache_size=32\nbinlog_expire_logs_seconds=1209600\n\n/" /etc/my.cnf > /tmp/my.cnf; \
 | 
				
			||||||
 | 
					    cp /tmp/my.cnf /etc/my.cnf; \
 | 
				
			||||||
 | 
					    sed -e "s/skip-networking/#skip-networking/" /etc/my.cnf.d/mariadb-server.cnf > /tmp/mariadb-server.cnf; \
 | 
				
			||||||
 | 
					    cp /tmp/mariadb-server.cnf /etc/my.cnf.d/mariadb-server.cnf; \
 | 
				
			||||||
 | 
					    mysql_install_db --user=mysql
 | 
				
			||||||
 | 
					RUN mysqld_safe --user=mysql & \
 | 
				
			||||||
 | 
					    sleep 5; \
 | 
				
			||||||
 | 
					    mysql -uroot -hlocalhost --execute="ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RUN echo -e "#!/usr/bin/env sh\n\nmysqld_safe --user=mysql &\n/usr/local/goedge/edge-admin/bin/edge-admin\n" > ${ROOT_DIR}/run.sh; \
 | 
				
			||||||
 | 
					    chmod u+x ${ROOT_DIR}/run.sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					EXPOSE 7788
 | 
				
			||||||
 | 
					EXPOSE 8001
 | 
				
			||||||
 | 
					EXPOSE 3306
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ENTRYPOINT [ "/usr/local/goedge/run.sh" ]
 | 
				
			||||||
							
								
								
									
										5
									
								
								docker/build.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										5
									
								
								docker/build.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					#!/usr/bin/env bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					VERSION=latest
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					docker build -t goedge/edge-admin:${VERSION} .
 | 
				
			||||||
							
								
								
									
										5
									
								
								docker/run.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										5
									
								
								docker/run.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					#!/usr/bin/env bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					VERSION=latest
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					docker run -d -p 7788:7788 -p 8001:8001 -p 3306:3306 --name edge-admin goedge/edge-admin:${VERSION}
 | 
				
			||||||
							
								
								
									
										2
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								go.mod
									
									
									
									
									
								
							@@ -3,9 +3,11 @@ module github.com/TeaOSLab/EdgeAdmin
 | 
				
			|||||||
go 1.18
 | 
					go 1.18
 | 
				
			||||||
 | 
					
 | 
				
			||||||
replace github.com/TeaOSLab/EdgeCommon => ../EdgeCommon
 | 
					replace github.com/TeaOSLab/EdgeCommon => ../EdgeCommon
 | 
				
			||||||
 | 
					replace github.com/TeaOSLab/EdgePlus => ../EdgePlus
 | 
				
			||||||
 | 
					
 | 
				
			||||||
require (
 | 
					require (
 | 
				
			||||||
	github.com/TeaOSLab/EdgeCommon v0.0.0-00010101000000-000000000000
 | 
						github.com/TeaOSLab/EdgeCommon v0.0.0-00010101000000-000000000000
 | 
				
			||||||
 | 
						github.com/TeaOSLab/EdgePlus v0.0.0-00010101000000-000000000000
 | 
				
			||||||
	github.com/cespare/xxhash v1.1.0
 | 
						github.com/cespare/xxhash v1.1.0
 | 
				
			||||||
	github.com/go-sql-driver/mysql v1.5.0
 | 
						github.com/go-sql-driver/mysql v1.5.0
 | 
				
			||||||
	github.com/iwind/TeaGo v0.0.0-20220304043459-0dd944a5b475
 | 
						github.com/iwind/TeaGo v0.0.0-20220304043459-0dd944a5b475
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,7 +22,7 @@ func (this *IndexAction) RunGet(params struct{}) {
 | 
				
			|||||||
			currentHost = host
 | 
								currentHost = host
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if net.ParseIP(currentHost) != nil {
 | 
						if net.ParseIP(currentHost) != nil && currentHost != "localhost" && currentHost != "127.0.0.1" {
 | 
				
			||||||
		this.Data["currentHost"] = currentHost
 | 
							this.Data["currentHost"] = currentHost
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		this.Data["currentHost"] = ""
 | 
							this.Data["currentHost"] = ""
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user