-
Notifications
You must be signed in to change notification settings - Fork 123
/
Dockerfile
47 lines (34 loc) · 1.08 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
#================================
# Stage 1: Build Gitbase
#================================
FROM golang:1.11-alpine as builder
ENV GITBASE_REPO=github.com/src-d/gitbase
ENV GITBASE_PATH=$GOPATH/src/$GITBASE_REPO
RUN apk add --update --no-cache libxml2-dev git make bash gcc g++ curl oniguruma-dev oniguruma
COPY . $GITBASE_PATH
WORKDIR $GITBASE_PATH
ENV GO_BUILD_ARGS="-o /bin/gitbase"
ENV GO_BUILD_PATH="./cmd/gitbase"
ENV GO111MODULE=on
ENV GOPROXY=https://proxy.golang.org
RUN make static-build
#=================================
# Stage 2: Start Gitbase Server
#=================================
FROM alpine:3.8
RUN apk add --no-cache mysql-client
RUN mkdir -p /opt/repos
EXPOSE 3306
ENV TINI_VERSION v0.18.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-static-amd64 /tini
RUN chmod +x /tini
ENTRYPOINT ["/tini", "--"]
ENV GITBASE_USER=root
ENV GITBASE_PASSWORD=""
ENV GITBASE_REPOS=/opt/repos
ENV MYSQL_HOST=127.0.0.1
# copy build artifacts
COPY --from=builder /bin/gitbase /bin/gitbase
ADD init.sh ./init.sh
RUN chmod +x ./init.sh
ENTRYPOINT ["./init.sh"]