Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[go modules] migrating to go modules #1052

Merged
merged 1 commit into from
Oct 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
language: go

go:
- '1.11.1'
- '1.11.4'
- '1.12'

go_import_path: github.com/prebid/prebid-server

env:
- DEP_VERSION="0.5.0"

before_install:
- curl -L -s https://github.com/golang/dep/releases/download/v${DEP_VERSION}/dep-linux-amd64 -o $GOPATH/bin/dep
- chmod +x $GOPATH/bin/dep

install:
- $GOPATH/bin/dep ensure
- GO111MODULE=on

script:
- "./validate.sh --nofmt --cov --race 10"
Expand Down
13 changes: 6 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,21 @@ RUN cd /tmp && \
wget https://dl.google.com/go/go1.12.7.linux-amd64.tar.gz && \
tar -xf go1.12.7.linux-amd64.tar.gz && \
mv go /usr/local
WORKDIR /go/src/github.com/prebid/prebid-server/
RUN mkdir -p /app/prebid-server/
WORKDIR /app/prebid-server/
ENV GOROOT=/usr/local/go
ENV GOPATH=/go
ENV PATH=$GOPATH/bin:$GOROOT/bin:$PATH
ENV PATH=$GOROOT/bin:$PATH
RUN apt-get update && \
apt-get install -y git go-dep && \
apt-get install -y git && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ENV CGO_ENABLED 0
COPY ./ ./
RUN dep ensure && \
go build .
RUN go build -mod=vendor .
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you recommend using the vendor directory versus the default $GOPATH\pkg\mod directory?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No preferences, but IMO modules allowing to work outside of the GOPATH is one of the best features, so just wanted to take this opportunity :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not opposed :), was just curious if you ran into an issue specific to building the Docker container. I like that it allows for a more targeted cache clean by the deps command.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it's ok for you this way? Also, I might introduce in another PR later a GOPROXY for modules to speed up the build.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I don't see a problem with it.

The proxy sounds interesting. I'm curious to see what that looks like.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @SyntaxNode , here you go for the proxy: #1079 :)


FROM ubuntu:18.04 AS release
LABEL maintainer="hans.hjort@xandr.com"
WORKDIR /usr/local/bin/
COPY --from=build /go/src/github.com/prebid/prebid-server/prebid-server .
COPY --from=build /app/prebid-server/ .
COPY static static/
COPY stored_requests/data stored_requests/data
RUN apt-get update && \
Expand Down
Loading