2024-04-07 21:43:12 +08:00
|
|
|
FROM registry.cn-hangzhou.aliyuncs.com/eryajf/golang:1.18.10-alpine3.17 AS builder
|
2022-06-01 17:16:45 +08:00
|
|
|
|
2024-04-04 16:27:34 +08:00
|
|
|
WORKDIR /app
|
2022-06-01 17:16:45 +08:00
|
|
|
|
2024-04-05 12:01:50 +08:00
|
|
|
ENV GOPROXY https://goproxy.io
|
|
|
|
|
2024-04-04 16:27:34 +08:00
|
|
|
RUN sed -i "s/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g" /etc/apk/repositories \
|
|
|
|
&& apk upgrade && apk add --no-cache --virtual .build-deps \
|
2024-04-04 17:36:01 +08:00
|
|
|
ca-certificates gcc g++ curl upx
|
2023-01-16 18:21:11 +08:00
|
|
|
|
2024-04-04 16:27:34 +08:00
|
|
|
ADD . .
|
2023-01-16 18:21:11 +08:00
|
|
|
|
2024-04-07 21:43:12 +08:00
|
|
|
COPY --from=registry.cn-hangzhou.aliyuncs.com/eryajf/docker-compose-wait /wait .
|
2024-04-05 12:01:50 +08:00
|
|
|
|
2024-04-04 16:27:34 +08:00
|
|
|
RUN release_url=$(curl -s https://api.github.com/repos/eryajf/go-ldap-admin-ui/releases/latest | grep "browser_download_url" | grep -v 'dist.zip.md5' | cut -d '"' -f 4); wget $release_url && unzip dist.zip && rm dist.zip && mv dist public/static
|
2023-01-16 18:21:11 +08:00
|
|
|
|
2022-07-13 16:43:05 +08:00
|
|
|
RUN sed -i 's@localhost:389@openldap:389@g' /app/config.yml \
|
2024-04-05 12:01:50 +08:00
|
|
|
&& sed -i 's@host: localhost@host: mysql@g' /app/config.yml && go build -o go-ldap-admin . && upx -9 go-ldap-admin && upx -9 wait
|
2022-06-01 17:16:45 +08:00
|
|
|
|
2023-01-16 18:21:11 +08:00
|
|
|
### build final image
|
2024-04-07 21:43:12 +08:00
|
|
|
FROM registry.cn-hangzhou.aliyuncs.com/eryajf/alpine:3.19
|
2023-01-16 18:21:11 +08:00
|
|
|
|
2024-04-04 16:27:34 +08:00
|
|
|
LABEL maintainer eryajf@163.com
|
2023-01-16 18:21:11 +08:00
|
|
|
|
2022-06-01 17:16:45 +08:00
|
|
|
WORKDIR /app
|
2023-01-16 18:21:11 +08:00
|
|
|
|
2024-04-04 16:27:34 +08:00
|
|
|
COPY --from=builder /app/wait .
|
|
|
|
COPY --from=builder /app/LICENSE .
|
|
|
|
COPY --from=builder /app/config.yml .
|
|
|
|
COPY --from=builder /app/go-ldap-admin .
|
2023-01-16 18:21:11 +08:00
|
|
|
|
|
|
|
RUN chmod +x wait go-ldap-admin
|
2022-06-01 23:06:27 +08:00
|
|
|
|
2023-05-31 22:18:22 +08:00
|
|
|
# see wait repo: https://github.com/ufoscout/docker-compose-wait
|
2022-07-13 16:43:05 +08:00
|
|
|
CMD ./wait && ./go-ldap-admin
|