From 9de796c26f5a9d572517f876048d72bd2e6363c4 Mon Sep 17 00:00:00 2001 From: Manfred Touron Date: Thu, 20 Feb 2020 11:39:28 +0100 Subject: [PATCH] feat: fix web --- .dockerignore | 1 + Dockerfile | 23 +++++++++++++++++++---- web/.env.dev | 4 ++++ web/.env.prod | 3 ++- 4 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 web/.env.dev diff --git a/.dockerignore b/.dockerignore index 0ff09cb7a..520e072ab 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,2 +1,3 @@ +Dockerfile dist/ vendor/ diff --git a/Dockerfile b/Dockerfile index 53c1812ed..0bc59d211 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,18 +3,32 @@ ARG BUILD_DATE ARG VCS_REF ARG VERSION -# build -FROM golang:1.13-alpine as build + +# web build +FROM node:10 as web-build +WORKDIR /app +COPY ./web/package*.json ./web/yarn.* ./ +RUN npm install +COPY ./web/ ./ +RUN npm run build + + +# go build +FROM golang:1.13-alpine as go-build RUN apk add --update --no-cache git gcc musl-dev make RUN GO111MODULE=off go get github.com/gobuffalo/packr/v2/packr2 WORKDIR /go/src/moul.io/depviz -ENV GO111MODULE=on +ENV GO111MODULE=on \ + GOPROXY=proxy.golang.org COPY go.* ./ RUN go mod download COPY . ./ +RUN rm -rf web +COPY --from=web-build /app/dist web RUN make packr RUN make install + # minimalist runtime FROM alpine:3.11 LABEL org.label-schema.build-date=$BUILD_DATE \ @@ -29,5 +43,6 @@ LABEL org.label-schema.build-date=$BUILD_DATE \ org.label-schema.cmd="docker run -i -t --rm moul/depviz" \ org.label-schema.help="docker exec -it $CONTAINER depviz --help" RUN apk add --update --no-cache ca-certificates -COPY --from=build /go/bin/depviz /bin/ +COPY --from=go-build /go/bin/depviz /bin/ ENTRYPOINT ["depviz"] +EXPOSE 8000 9000 diff --git a/web/.env.dev b/web/.env.dev new file mode 100644 index 000000000..045c4c95f --- /dev/null +++ b/web/.env.dev @@ -0,0 +1,4 @@ +NODE_ENV=development +__DEV__=true +#API_URL=http://localhost:8000/api +API_URL=/api diff --git a/web/.env.prod b/web/.env.prod index 6269ef0f5..342c140be 100644 --- a/web/.env.prod +++ b/web/.env.prod @@ -1,3 +1,4 @@ NODE_ENV=production __DEV__=false -API_URL=https://depviz-demo.moul.io/api +#API_URL=https://depviz-demo.moul.io/api +API_URL=/api