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