forked from paust-team/pirius
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
47 lines (39 loc) · 1.36 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 golang:1.18-alpine3.16 AS builder
RUN apk update && apk add build-base git \
gcc file cmake autoconf automake libtool curl make linux-headers zlib-dev \
g++ unzip dep bash coreutils zstd-dev snappy-dev lz4-dev
ENV USER=piriususer
ENV UID=11010
ENV GID=11011
RUN addgroup --gid "$GID" "$USER" \
&& adduser \
--disabled-password \
--gecos "" \
--home "$(pwd)" \
--ingroup "$USER" \
--no-create-home \
--uid "$UID" \
"$USER"
ENV HOME_DIR=/pirius
WORKDIR ${HOME_DIR}
RUN uname -a
COPY . .
RUN go mod download &&\
git submodule update --init --recursive &&\
make clean install DEPLOY_TARGET=release &&\
cp -rf ~/.pirius /pirius/.pirius
FROM alpine:3.16
RUN apk add --no-cache libstdc++ bash snappy &&\
mkdir /pirius
COPY --from=builder /etc/passwd /etc/passwd
COPY --from=builder /etc/group /etc/group
COPY --from=builder /usr/local/bin/pirius-broker /pirius/bin/pirius-broker
COPY --from=builder /usr/local/bin/pirius-agent /pirius/bin/pirius-agent
COPY --from=builder /pirius/start-broker.sh /pirius/start-broker.sh
COPY --from=builder /pirius/.pirius/config /pirius/config
WORKDIR /pirius
RUN chown -R piriususer:piriususer /pirius && chmod -R 777 /pirius
USER piriususer:piriususer
EXPOSE 1101
ENV ZK_QUORUM="127.0.0.1:2181" HOME=/pirius
ENTRYPOINT ["bash", "-c", "./start-broker.sh $ZK_QUORUM /pirius/config/broker/config.yml"]