Skip to content
Open
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
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM golang:1.9.3-stretch AS build-env

RUN go-wrapper download github.com/golang/dep/cmd/dep && go-wrapper install github.com/golang/dep/cmd/dep

WORKDIR /go/src/github.com/larsp/co2monitor

# only copy Gopkg.toml and Gopkg.lock for now so dep ensure run keeps cached till those files are changed
COPY Gopkg.* ./
RUN dep ensure -v --vendor-only

COPY . ./
RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -v -ldflags "-w -s" -a -installsuffix cgo -o /out/co2monitor

FROM scratch
COPY --from=build-env /out/co2monitor /
ENTRYPOINT [ "./co2monitor" ]
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ build:
build_pi:
GOOS=linux GOARCH=arm GOARM=6 go build -v

build_docker_pi:
docker build .

test:
go test --race -v ./...

Expand Down