Skip to content

Commit

Permalink
feat: 调整dockercompose等内容,以适配新的构建方式 (#327)
Browse files Browse the repository at this point in the history
  • Loading branch information
eryajf authored Apr 5, 2024
1 parent 7589182 commit 8ec8e44
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 71 deletions.
46 changes: 46 additions & 0 deletions .air.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
root = "."
testdata_dir = "testdata"
tmp_dir = "tmp"

[build]
args_bin = []
bin = "./tmp/main"
cmd = "go build -o ./tmp/main ."
delay = 1000
exclude_dir = ["assets", "tmp", "vendor", "testdata"]
exclude_file = []
exclude_regex = ["_test.go"]
exclude_unchanged = false
follow_symlink = false
full_bin = ""
include_dir = []
include_ext = ["go", "tpl", "tmpl", "html"]
include_file = []
kill_delay = "0s"
log = "build-errors.log"
poll = false
poll_interval = 0
post_cmd = []
pre_cmd = []
rerun = false
rerun_delay = 500
send_interrupt = false
stop_on_error = false

[color]
app = ""
build = "yellow"
main = "magenta"
runner = "green"
watcher = "cyan"

[log]
main_only = false
time = false

[misc]
clean_on_exit = false

[screen]
clear_on_rebuild = false
keep_scroll = true
8 changes: 4 additions & 4 deletions .github/workflows/build-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ jobs:
push: ${{ github.event_name != 'pull_request' }}
# 给清单打上多个标签
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/go-ldap-admin-server:latest
${{ secrets.DOCKERHUB_USERNAME }}/go-ldap-admin-server:${{ steps.date.outputs.today }}
${{ secrets.DOCKERHUB_USERNAME }}/go-ldap-admin:latest
${{ secrets.DOCKERHUB_USERNAME }}/go-ldap-admin:${{ steps.date.outputs.today }}
# 镜像推送到 阿里云仓库
- name: Login to the Ali Registry
Expand All @@ -80,5 +80,5 @@ jobs:
push: true
platforms: linux/amd64,linux/arm64
tags: |
registry.cn-hangzhou.aliyuncs.com/${{ secrets.ALIHUB_USERNAME }}/go-ldap-admin-server:${{ env.GITHUB_REF_NAME }}
registry.cn-hangzhou.aliyuncs.com/${{ secrets.ALIHUB_USERNAME }}/go-ldap-admin-server:latest
registry.cn-hangzhou.aliyuncs.com/${{ secrets.ALIHUB_USERNAME }}/go-ldap-admin:${{ env.GITHUB_REF_NAME }}
registry.cn-hangzhou.aliyuncs.com/${{ secrets.ALIHUB_USERNAME }}/go-ldap-admin:latest
7 changes: 2 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
.vscode
.token

build.sh
logs
go-web-mini
go-ldap-admin
go-ldap-admin.db

# Test binary, built with `go test -c`
*.test
Expand All @@ -24,4 +20,5 @@ go-ldap-admin.db
# vendor/
tmp
docs/docker-compose/data
dist
dist
data
4 changes: 2 additions & 2 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ logs:
# 日志等级(-1:Debug, 0:Info, 1:Warn, 2:Error, 3:DPanic, 4:Panic, 5:Fatal, -1<=level<=5, 参照zap.level源码)
level: -1
# 日志路径
path: logs
path: data/logs
# 文件最大大小, M
max-size: 50
# 备份数
Expand All @@ -27,7 +27,7 @@ database:
# 数据库类型 mysql sqlite3
driver: mysql
# 数据库连接sqlite3数据文件的路径
source: go-ldap-admin.db
source: data/go-ldap-admin.db

mysql:
# 用户名
Expand Down
5 changes: 5 additions & 0 deletions docs/custom-openldap-dockerfile/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM registry.cn-hangzhou.aliyuncs.com/ali_eryajf/openldap:1.4.0

LABEL maintainer https://github.com/eryajf

ADD init.ldif /container/service/slapd/assets/config/bootstrap/ldif/custom/
3 changes: 3 additions & 0 deletions docs/custom-openldap-dockerfile/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
docker build --no-cache . -t registry.cn-hangzhou.aliyuncs.com/ali_eryajf/openldap:1.4.1
docker push registry.cn-hangzhou.aliyuncs.com/ali_eryajf/openldap:1.4.1
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
dn: ou=people,dc=eryajf,dc=net
dn: ou=people,{{ LDAP_BASE_DN }}
ou: people
description: 用户根目录
objectClass: organizationalUnit

dn: ou=dingtalkroot,dc=eryajf,dc=net
dn: ou=dingtalkroot,{{ LDAP_BASE_DN }}
ou: dingtalkroot
description: 钉钉根部门
objectClass: top
objectClass: organizationalUnit

dn: ou=wecomroot,dc=eryajf,dc=net
dn: ou=wecomroot,{{ LDAP_BASE_DN }}
ou: wecomroot
description: 企业微信根部门
objectClass: top
objectClass: organizationalUnit

dn: ou=feishuroot,dc=eryajf,dc=net
dn: ou=feishuroot,{{ LDAP_BASE_DN }}
ou: feishuroot
description: 飞书根部门
objectClass: top
objectClass: organizationalUnit

dn: cn=group,dc=eryajf,dc=net
dn: cn=group,{{ LDAP_BASE_DN }}
cn: group
description: 默认分组
objectClass: top
objectClass: groupOfUniqueNames
objectClass: groupOfUniqueNames
uniqueMember: cn=admin,{{ LDAP_BASE_DN }}
40 changes: 0 additions & 40 deletions docs/docker-compose/config/my.cnf

This file was deleted.

23 changes: 9 additions & 14 deletions docs/docker-compose/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ networks:

services:
mysql:
image: registry.cn-hangzhou.aliyuncs.com/ali_eryajf/mysql-server:5.7
image: registry.cn-hangzhou.aliyuncs.com/ali_eryajf/mysql:8.3
container_name: go-ldap-admin-mysql # 指定容器名称,如果不设置此参数,则由系统自动生成
hostname: go-ldap-admin-mysql
restart: always # 设置容器自启模式
Expand All @@ -18,16 +18,12 @@ services:
MYSQL_ROOT_HOST: "%"
MYSQL_DATABASE: go_ldap_admin
volumes:
# 数据挂载目录自行修改哦!
- /etc/localtime:/etc/localtime:ro # 设置容器时区与宿主机保持一致
- ./data/mysql:/var/lib/mysql/data # 映射数据库保存目录到宿主机,防止数据丢失
- ./config/my.cnf:/etc/mysql/my.cnf # 映射数据库配置文件
command: --default-authentication-plugin=mysql_native_password #解决外部无法访问
- ./data/mysql:/var/lib/mysql # 映射数据库保存目录到宿主机,防止数据丢失
networks:
- go-ldap-admin

openldap:
image: registry.cn-hangzhou.aliyuncs.com/ali_eryajf/openldap:1.4.0
image: registry.cn-hangzhou.aliyuncs.com/ali_eryajf/openldap:1.4.1
container_name: go-ldap-admin-openldap
hostname: go-ldap-admin-openldap
restart: always
Expand All @@ -40,7 +36,6 @@ services:
volumes:
- ./data/openldap/database:/var/lib/ldap
- ./data/openldap/config:/etc/ldap/slapd.d
- ./config/init.ldif:/container/service/slapd/assets/config/bootstrap/ldif/custom/init.ldif
ports:
- 388:389
networks:
Expand All @@ -66,17 +61,17 @@ services:
networks:
- go-ldap-admin

go-ldap-admin-server:
image: registry.cn-hangzhou.aliyuncs.com/ali_eryajf/go-ldap-admin-server
container_name: go-ldap-admin-server
hostname: go-ldap-admin-server
go-ldap-admin:
image: registry.cn-hangzhou.aliyuncs.com/ali_eryajf/go-ldap-admin
container_name: go-ldap-admin
hostname: go-ldap-admin
restart: always
environment:
WAIT_HOSTS: mysql:3306, openldap:389
ports:
- 8888:8888
# volumes: # 可按需打开此配置,将配置文件挂载到本地 可在服务运行之后,执行 docker cp go-ldap-admin-server:/app/config.yml ./config 然后再取消该行注释
# - ./config/config.yml:/app/config.yml
volumes:
- ./data/go-ldap-admin:/app/data
depends_on:
- mysql
- openldap
Expand Down

0 comments on commit 8ec8e44

Please sign in to comment.