1FROM golang:1.10-alpine
2ADD . /go/src/repodiff
3RUN apk --no-cache add \
4      curl \
5      git \
6      build-base \
7      && curl https://raw.githubusercontent.com/golang/dep/5bdae264c61be23446d622ea84a1c97b895f78cc/install.sh | sh \
8      && curl https://storage.googleapis.com/git-repo-downloads/repo > /bin/repo \
9      && chmod a+x /bin/repo \
10      && cd /go/src/repodiff \
11      && dep ensure \
12      && go install repodiff \
13      && cp config.json /go/bin/ \
14      && cp .gitcookies /go/bin/ \
15      && cp .gitconfig /go/bin/ \
16      && cp credentials.json /go/bin/
17
18FROM alpine:3.7
19RUN apk --no-cache add \
20      bash \
21      git \
22      python \
23      && mkdir -p /app_output
24COPY --from=0 /bin/repo /bin/repo
25WORKDIR /app
26COPY --from=0 /go/bin/repodiff .
27COPY --from=0 /go/bin/config.json .
28COPY --from=0 /go/bin/.git* /root/
29COPY --from=0 /go/bin/credentials.json .
30COPY --from=0 /go/bin/credentials.json .
31COPY --from=0 /go/src/repodiff/*py ./pytools/
32COPY --from=0 /go/src/repodiff/*txt ./pytools/
33
34ENV GCP_DB_INSTANCE_CONNECTION_NAME_DEV=$GCP_DB_INSTANCE_CONNECTION_NAME_DEV
35ENV GCP_DB_USER_DEV=$GCP_DB_USER_DEV
36ENV GCP_DB_PASSWORD_DEV=$GCP_DB_PASSWORD_DEV
37ENV GCP_DB_NAME_DEV=$GCP_DB_NAME_DEV
38ENV GCP_DB_PROXY_PORT_DEV=$GCP_DB_PROXY_PORT_DEV
39ENV GCP_DB_INSTANCE_CONNECTION_NAME_PROD=$GCP_DB_INSTANCE_CONNECTION_NAME_PROD
40ENV GCP_DB_USER_PROD=$GCP_DB_USER_PROD
41ENV GCP_DB_PASSWORD_PROD=$GCP_DB_PASSWORD_PROD
42ENV GCP_DB_NAME_PROD=$GCP_DB_NAME_PROD
43ENV GCP_DB_PROXY_PORT_PROD=$GCP_DB_PROXY_PORT_PROD
44ENV ROLE="prod"
45ENV GOOGLE_APPLICATION_CREDENTIALS="/app/credentials.json"
46
47CMD ["./repodiff"]
48