-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
59 lines (42 loc) · 2 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
48
49
50
51
52
53
54
55
56
57
58
59
# Copyright 2018 The OpenPitrix Authors. All rights reserved.
# Use of this source code is governed by a Apache license
# that can be found in the LICENSE file.
# -----------------------------------------------------------------------------
# builder
# -----------------------------------------------------------------------------
FROM golang:1.11-alpine3.7 as builder
# intall tools
RUN apk add --no-cache git
# install /usr/bin/nsenter
RUN apk add --no-cache util-linux
WORKDIR /build-dir
COPY . .
ENV GO111MODULE=on
ENV CGO_ENABLED=0
ENV GOOS=linux
ENV GOBIN=/build-dir
RUN echo module drone > /build-dir/go.mod
RUN git describe --tags --always > /build-dir/version
RUN git describe --exact-match 2>/dev/null || git log -1 --format="%H" > /build-dir/version
RUN go get -ldflags '-w -s' -tags netgo openpitrix.io/metadata/cmd/drone@$(cat /build-dir/version)
RUN go get -ldflags '-w -s' -tags netgo openpitrix.io/metadata/cmd/frontgate@$(cat /build-dir/version)
RUN echo version: $(cat /build-dir/version)
# -----------------------------------------------------------------------------
# for metadata image
# -----------------------------------------------------------------------------
FROM alpine:3.7
COPY --from=builder /usr/bin/nsenter /usr/bin/
COPY --from=builder /build-dir/drone /usr/local/bin/
COPY --from=builder /build-dir/frontgate /usr/local/bin/
RUN apk add --no-cache supervisor
COPY build/supervisord/supervisord.conf /etc/
COPY build/supervisord/start-supervisord.sh /usr/local/bin/
COPY build/supervisord/frontgate/start-frontgate.sh /usr/local/bin/
COPY build/supervisord/drone/start-drone.sh /usr/local/bin/
RUN mkdir -p /etc/supervisor.d
COPY build/supervisord/frontgate/frontgate.ini /etc/supervisor.d
COPY build/supervisord/drone/drone.ini /etc/supervisor.d
ENTRYPOINT ["start-supervisord.sh"]
# -----------------------------------------------------------------------------
# END
# -----------------------------------------------------------------------------