From b2917ad0cdb53b4f6b25370ddeed291ed95f84d2 Mon Sep 17 00:00:00 2001 From: Simone Gotti Date: Thu, 21 Feb 2019 16:10:30 +0100 Subject: [PATCH] Add dockerfile --- .dockerignore | 2 ++ Dockerfile | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..be22bde --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +bin/ +vendor/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2510b8d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,42 @@ +####### +####### Build the backend +####### + +# Base build image +FROM golang:1.11 AS build_base + +WORKDIR /agola + +# use go modules +ENV GO111MODULE=on + +# Only copy go.mod and go.sum +COPY go.mod . +COPY go.sum . + +RUN go mod download + +# This image builds the weavaite server +FROM build_base AS server_builder + +# Copy all the source +COPY . . + +# Copy the agola-web dist +COPY --from=agola-web /agola-web/dist/ /agola-web/dist/ + +RUN make WEBBUNDLE=1 WEBDISTPATH=/agola-web/dist +#RUN go build -tags "sqlite_unlock_notify webbundle" -o /go/bin/agola ./cmd/agola +#RUN CGO_ENABLED=0 go build -tags "sqlite_unlock_notify webbundle" -o /go/bin/agola-toolbox ./cmd/toolbox + + +####### +####### Build the final image +####### +FROM debian:stable + +WORKDIR /go/src/github.com/sorintlab/agola + +# Finally we copy the statically compiled Go binary. +COPY --from=server_builder /agola/bin/agola /agola/bin/agola-toolbox /bin/ +ENTRYPOINT ["/bin/agola"] \ No newline at end of file