Skip to content

Commit

Permalink
Changes in rover to cross compile rover
Browse files Browse the repository at this point in the history
  • Loading branch information
parauliya committed Mar 5, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 11bca36 commit eb69203
Showing 7 changed files with 19 additions and 15 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
/rover
bin/
certs/
rover-linux-x86_64
rover-worker-linux-x86_64

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -8,4 +8,4 @@ RUN apk add --no-cache --update --upgrade ca-certificates postgresql-client
RUN apk add --no-cache --update --upgrade --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing cfssl
COPY deploy/migrate /migrate
COPY deploy/docker-entrypoint-initdb.d/rover-init.sql /init.sql
COPY rover-linux-x86_64 /rover
COPY bin/rover-server /rover
18 changes: 11 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
server := rover-linux-x86_64
cli := cmd/rover/rover-linux-x86_64
worker := worker/rover-worker-linux-x86_64
binaries := ${server} ${cli} ${worker}
bindir := bin
server := ${bindir}/rover-server
cli := ${bindir}/rover-cli
worker := ${bindir}/rover-worker
binaries := ${bindir} ${server} ${cli} ${worker}
all: ${binaries}

.PHONY: server ${binaries} cli worker test
server: ${server}
cli: ${cli}
worker : ${worker}

${bindir}:
mkdir -p $@/

${server}:
CGO_ENABLED=0 GOOS=linux go build -o $@ ./$(@D)
CGO_ENABLED=0 go build -o $@ .

${cli}:
CGO_ENABLED=0 GOOS=linux go build -o $@ ./$(@D)
CGO_ENABLED=0 go build -o $@ ./cmd/rover

${worker}:
CGO_ENABLED=0 GOOS=linux go build -o $@ ./$(@D)
CGO_ENABLED=0 go build -o $@ ./worker/

run: ${binaries}
docker-compose up -d --build db
2 changes: 1 addition & 1 deletion cmd/rover/Dockerfile
Original file line number Diff line number Diff line change
@@ -3,5 +3,5 @@ FROM alpine:3.7
CMD sleep 60d

RUN apk add --no-cache --update --upgrade ca-certificates
COPY rover-linux-x86_64 /bin/rover
COPY bin/rover-cli /bin/rover
COPY sample.tmpl /tmp
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -61,7 +61,8 @@ services:

cli:
build:
context: cmd/rover
context: .
dockerfile: cmd/rover/Dockerfile
environment:
ROVER_GRPC_AUTHORITY: 127.0.0.1:42113
ROVER_CERT_URL: http://127.0.0.1:42114/cert
3 changes: 2 additions & 1 deletion test-docker-compose.yml
Original file line number Diff line number Diff line change
@@ -65,7 +65,8 @@ services:

cli:
build:
context: cmd/rover
context: .
dockerfile: cmd/rover/Dockerfile
environment:
ROVER_GRPC_AUTHORITY: 127.0.0.1:42113
ROVER_CERT_URL: http://127.0.0.1:42114/cert
4 changes: 2 additions & 2 deletions worker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM alpine:3.10

RUN apk add --no-cache --update --upgrade ca-certificates
COPY rover-worker-linux-x86_64 /bin/worker
ENTRYPOINT [ "/bin/worker" ]
COPY bin/rover-worker /bin/worker
ENTRYPOINT [ "/bin/worker" ]

0 comments on commit eb69203

Please sign in to comment.