forked from eryajf/go-ldap-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
40 lines (25 loc) · 847 Bytes
/
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
FROM golang:1.18.10-alpine3.16 AS builder
# ENV GOPROXY https://goproxy.io
RUN mkdir /app && apk add --no-cache --virtual .build-deps \
ca-certificates \
gcc \
g++
ADD . /app/
WORKDIR /app
RUN sed -i 's@localhost:389@openldap:389@g' /app/config.yml \
&& sed -i 's@host: localhost@host: mysql@g' /app/config.yml && go build -o go-ldap-admin .
### build final image
FROM alpine:3.16
# we set the timezone `Asia/Shanghai` by default, you can be modified
# by `docker build --build-arg="TZ=Other_Timezone ..."`
ARG TZ="Asia/Shanghai"
ENV TZ ${TZ}
RUN mkdir /app
WORKDIR /app
COPY --from=builder /app/ .
RUN apk upgrade \
&& apk add bash tzdata sqlite vim \
&& ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime \
&& echo ${TZ} > /etc/timezone
RUN chmod +x wait go-ldap-admin
CMD ./wait && ./go-ldap-admin