feat: 调整dockerfile初始化方式 (#73)

This commit is contained in:
二丫讲梵 2022-07-13 10:54:34 +08:00 committed by GitHub
parent 3c15977fcb
commit d2158b35d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 6 deletions

View File

@ -5,15 +5,12 @@ FROM golang:1.17.10 AS builder
RUN mkdir /app RUN mkdir /app
ADD . /app/ ADD . /app/
WORKDIR /app WORKDIR /app
RUN sed -i 's@host: localhost@host: mysql@g' config.yml \ RUN go build -o go-ldap-admin .
&& sed -i 's@localhost:389@openldap:389@g' config.yml \
&& go build -o go-ldap-admin .
FROM centos:centos7 FROM centos:centos7
RUN mkdir /app RUN mkdir /app
WORKDIR /app WORKDIR /app
COPY --from=builder /app/wait .
COPY --from=builder /app/ . COPY --from=builder /app/ .
RUN chmod +x wait go-ldap-admin && yum -y install vim net-tools telnet wget curl && yum clean all RUN chmod +x wait go-ldap-admin docker-start.sh && yum -y install vim net-tools telnet wget curl && yum clean all
CMD ./wait && ./go-ldap-admin CMD [ "sh", "-c", "docker-start.sh" ]

11
docker-start.sh Normal file
View File

@ -0,0 +1,11 @@
#/bin/bash
# 修改配置文件中的连接地址
sed -i 's@localhost:389@openldap:389@g' /app/config.yml
sed -i 's@host: localhost@host: mysql@g' /aap/config.yml
# 等待依赖项初始化成功
/app/wait
# 启动服务
/app/go-ldap-admin