From 5123e0ba560b22d910e5de20157a77f84dd0f91f Mon Sep 17 00:00:00 2001 From: connorwalsh Date: Fri, 9 Mar 2018 22:31:15 -0500 Subject: [PATCH] [cw|#5] recover from merging master into this branch >_< Major Changes: * rename dockerfiles * adjust docker-compose * adjust Dockerfile-server --- Dockerfile~HEAD => Dockerfile-server | 28 ++++++++++------------------ Dockerfile => Dockerfile-vm | 0 docker-compose.yml | 4 +++- 3 files changed, 13 insertions(+), 19 deletions(-) rename Dockerfile~HEAD => Dockerfile-server (62%) rename Dockerfile => Dockerfile-vm (100%) diff --git a/Dockerfile~HEAD b/Dockerfile-server similarity index 62% rename from Dockerfile~HEAD rename to Dockerfile-server index 2c3f322..ce33281 100644 --- a/Dockerfile~HEAD +++ b/Dockerfile-server @@ -3,37 +3,29 @@ FROM golang:1.9-alpine as server # GOPATH = /go in the golang image # also $GOPATH/bin has been added to path -WORKDIR /go/src/ +WORKDIR /go/src/github.com/frenata/compilebox # copy API server src to be compiled -COPY API/ ./ - -# currently, we need to install several dependencies -# note that we must install Docker, but when we run the container, we must -# mount the /var/run/docker.sock of the host onto the container so the host -# docker daemon spins up sibling containers (as opposed to Docker in Docker) -# -# TODO (cw|3.9.18) once we remove the dependency on gb, we will only need to -# install docker here. -RUN apk update && \ - apk add --no-cache git && \ - go get github.com/constabulary/gb/... && \ - apk del git && \ - apk add docker +COPY . . # compile and install server binary within container -RUN gb build && \ - mv ./bin/compilebox /go/bin +RUN go install ./cmd/compilebox FROM alpine WORKDIR /bin/ +# note that we must install Docker, but when we run the container, we must +# mount the /var/run/docker.sock of the host onto the container so the host +# docker daemon spins up sibling containers (as opposed to Docker in Docker) +RUN apk update && \ + apk add docker + # copy over single binary from build stage --^ COPY --from=server /go/bin/compilebox . # copy compilers data -COPY ./API/data/compilers.json ./data/compilers.json +COPY ./data/compilers.json ./data/compilers.json # run comilebox API server CMD ["compilebox"] diff --git a/Dockerfile b/Dockerfile-vm similarity index 100% rename from Dockerfile rename to Dockerfile-vm diff --git a/docker-compose.yml b/docker-compose.yml index 689560f..6295a50 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,6 +3,7 @@ services: compilebox_api_server: build: context: . + dockerfile: Dockerfile-server env_file: .env volumes: - /var/run/docker.sock:/var/run/docker.sock # use host Docker daemon @@ -13,5 +14,6 @@ services: compilebox: env_file: .env build: - context: ./Setup/ + context: . + dockerfile: Dockerfile-vm command: echo "compilebox build complete"