forked from bitpoke/mysql-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.orchestrator
70 lines (57 loc) · 2.7 KB
/
Dockerfile.orchestrator
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
###############################################################################
# Build the mysql-oerator related binaries
###############################################################################
FROM golang:1.13.14 as builder
# Copy in the go src
WORKDIR /go/src/github.com/presslabs/mysql-operator
COPY pkg/ pkg/
COPY cmd/ cmd/
COPY go.mod go.sum ./
# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o mysql-operator github.com/presslabs/mysql-operator/cmd/mysql-operator
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o mysql-operator-sidecar github.com/presslabs/mysql-operator/cmd/mysql-operator-sidecar
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o orc-helper github.com/presslabs/mysql-operator/cmd/orc-helper
##############################################################################
# Build Orchestrator
###############################################################################
FROM golang:1.13.7-alpine as builder-orc
RUN set -ex \
&& apk add --no-cache \
bash gcc git musl-dev openssl rsync perl-utils
ARG ORCHESTRATOR_VERSION=v3.1.4
ARG ORCHESTRATOR_REPO=https://github.com/github/orchestrator.git
RUN set -ex \
&& mkdir -p $GOPATH/src/github.com/github/orchestrator \
&& cd $GOPATH/src/github.com/github/orchestrator \
&& git init && git remote add origin $ORCHESTRATOR_REPO \
&& git fetch --tags \
&& git checkout $ORCHESTRATOR_VERSION
WORKDIR $GOPATH/src/github.com/github/orchestrator
RUN set -ex \
&& ls -l \
&& ./script/build
###############################################################################
# Docker image for orchestrator
###############################################################################
FROM alpine:3.11
# Create a group and user
RUN addgroup -g 777 orchestrator && adduser -u 777 -g 777 -S orchestrator
ENV DOCKERIZE_VERSION v0.6.1
RUN set -ex \
&& apk add --update --no-cache \
curl \
wget \
tar \
openssl \
&& mkdir /etc/orchestrator /var/lib/orchestrator \
&& chown -R 777:777 /etc/orchestrator /var/lib/orchestrator \
&& wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz -O- | \
tar -C /usr/local/bin -xzv
COPY --chown=777:777 hack/docker/orchestrator/ /
COPY --from=builder-orc /go/src/github.com/github/orchestrator/bin/ /usr/local/orchestrator/
COPY --from=builder /go/src/github.com/presslabs/mysql-operator/orc-helper /usr/local/bin/
USER 777
EXPOSE 3000 10008
VOLUME [ "/var/lib/orchestrator" ]
ENTRYPOINT ["/usr/local/bin/docker-entrypoint"]
CMD ["/usr/local/bin/orchestrator", "-quiet", "-config", "/etc/orchestrator/orchestrator.conf.json", "http"]