Skip to content
This repository has been archived by the owner on Jun 20, 2018. It is now read-only.

Commit

Permalink
Make it possible to not have to copy everything into container
Browse files Browse the repository at this point in the history
We do not want to copy the whole project into the Docker
container due to 'go get' using GOPATH (which, by default,
is the project root) as mentioned in #33. We don't need
the vendor folder to pull this off, but it makes more
clear which pkgs are considered 'external'.
  • Loading branch information
peterjasc committed Jul 20, 2016
1 parent b73521b commit b20b916
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 16 deletions.
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ services:
fox:
build:
context: .
dockerfile: ./src/github.com/e-gov/fox/Dockerfile
dockerfile: ./src/github.com/e-gov/fox/fox/Dockerfile
login:
build:
context: .
dockerfile: ./src/github.com/e-gov/login/Dockerfile
dockerfile: ./src/github.com/e-gov/fox/login/Dockerfile
haproxy:
build:
context: .
Expand Down
22 changes: 15 additions & 7 deletions src/github.com/e-gov/fox/fox/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
#=============== FoxService ===============
FROM golang:1.6

COPY ./src/github.com/e-gov/fox/ /fox/
RUN mkdir -p /src/github.com/e-gov/fox/fox/

ENV GOPATH=/fox/vendor
COPY ./src/github.com/e-gov/fox/fox/ /src/github.com/e-gov/fox/fox/

WORKDIR /fox/foxservice/
RUN mkdir -p /src/vendor/github.com/e-gov/fox/

RUN mkdir /fox/vendor && go get \
&& CGO_ENABLED=0 go build -a -installsuffix cgo -v \
-o foxservice.o FoxService.go
WORKDIR /src/vendor/github.com/e-gov/fox/

COPY ./src/github.com/e-gov/fox/authn/ authn/
COPY ./src/github.com/e-gov/fox/authz/ authz/
COPY ./src/github.com/e-gov/fox/util/ util/

COPY foxservice.o /bin/foxservice
ENV GOPATH=/

WORKDIR /src/github.com/e-gov/fox/fox/foxservice/

RUN go get -d && CGO_ENABLED=0 go build -a -installsuffix cgo -v \
-o foxservice.o FoxService.go \
&& cp foxservice.o /bin/foxservice

CMD ["bin/foxservice"]

22 changes: 15 additions & 7 deletions src/github.com/e-gov/fox/login/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
#=============== LoginService ===============
FROM golang:1.6

COPY ./src/github.com/e-gov/login/ /login/
RUN mkdir -p /src/github.com/e-gov/fox/login/

ENV GOPATH=/login/vendor/
COPY ./src/github.com/e-gov/fox/login/ /src/github.com/e-gov/fox/login/

WORKDIR /login/loginservice/
RUN mkdir -p /src/vendor/github.com/e-gov/fox/

RUN mkdir /login/vendor && go get \
&& CGO_ENABLED=0 go build -a -installsuffix cgo -v \
-o loginservice.o LoginService.go
WORKDIR /src/vendor/github.com/e-gov/fox/

COPY ./src/github.com/e-gov/fox/authn/ authn/
COPY ./src/github.com/e-gov/fox/authz/ authz/
COPY ./src/github.com/e-gov/fox/util/ util/

COPY loginservice.o /bin/loginservice
ENV GOPATH=/

WORKDIR /src/github.com/e-gov/fox/login/loginservice/

RUN go get -d && CGO_ENABLED=0 go build -a -installsuffix cgo -v \
-o loginservice.o LoginService.go \
&& cp loginservice.o /bin/loginservice

CMD ["bin/loginservice"]

0 comments on commit b20b916

Please sign in to comment.