-
Notifications
You must be signed in to change notification settings - Fork 20
/
Dockerfile
47 lines (42 loc) · 1.6 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
FROM eclipse-temurin:8-jdk-focal
MAINTAINER qianmoQ "[email protected]"
# 安装并配置 Nginx
RUN apt-get update && \
apt-get install -y nginx && \
rm -rf /var/lib/apt/lists/*
COPY configure/proxy/nginx.conf /etc/nginx/conf.d/authx.conf
COPY core/authx-web/dist /opt/app/authx-web
RUN nginx -V
CMD ["nginx", "-g", "daemon off;"]
# 安装 MySQL
RUN apt-get update && \
apt-get install -y mysql-server && \
rm -rf /var/lib/apt/lists/*
RUN service mysql start && \
mysqladmin -u root password '12345678'
COPY configure/docker/my.cnf /etc/mysql/my.cnf
# 执行MySQL命令来加载数据
RUN mkdir -p /opt/authx_mysql/
COPY script/schema/schema.sql /opt/authx_mysql/
RUN service mysql start && \
mysql -u root -p'12345678' -e "CREATE DATABASE authx;" && \
mysql -u root -p'12345678' -e "CREATE USER 'root'@'%' IDENTIFIED BY '12345678';" && \
mysql -u root -p'12345678' -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;" && \
mysql -u root -p'12345678' -e "FLUSH PRIVILEGES;" && \
mysql -u root -p'12345678' -e "delete from mysql.user where user = 'root' and host = 'localhost';" && \
mysql -u root -p'12345678' -e "ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '12345678';" && \
mysql -u root -p'12345678' authx < /opt/authx_mysql/schema.sql
CMD ["mysqld_safe"]
# 安装 Authx
RUN mkdir -p /opt/app
ADD dist/authx-release.tar.gz /opt/app/
COPY configure/docker/entrypoint.sh /opt/app/authx
WORKDIR /opt/app/authx
# MySQL端口 3306
EXPOSE 3306
# Web端口 9998
EXPOSE 9096
# API端口 9999
EXPOSE 9999
# 运行主服务
ENTRYPOINT ["sh", "entrypoint.sh"]