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

Support ARM arch #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion Dockerfile → DockerfileAMD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.8 as builder
FROM golang:1.9 as builder

ADD . /go/src/github.com/justwatchcom/github-releases-notifier
WORKDIR /go/src/github.com/justwatchcom/github-releases-notifier
Expand Down
15 changes: 15 additions & 0 deletions DockerfileARM
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM golang:1.9 as builder

ADD . /go/src/github.com/justwatchcom/github-releases-notifier
WORKDIR /go/src/github.com/justwatchcom/github-releases-notifier

RUN make buildarm

FROM arm32v6/alpine:3.7
RUN apk --no-cache add ca-certificates

COPY --from=builder \
/go/src/github.com/justwatchcom/github-releases-notifier/github-releases-notifier \
/bin/github-releases-notifier

ENTRYPOINT [ "/bin/github-releases-notifier" ]
36 changes: 30 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ GOLDFLAGS += -X "main.date=$(DATE)"
GOLDFLAGS += -X "main.commit=$(SHA)"
GOLDFLAGS += -extldflags '-static'

GO := CGO_ENABLED=0 go
GO := CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go
GOARM := CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go

GOOS ?= $(shell go version | cut -d' ' -f4 | cut -d'/' -f1)
GOARCH ?= $(shell go version | cut -d' ' -f4 | cut -d'/' -f2)
Expand All @@ -23,12 +24,13 @@ PACKAGES ?= $(shell go list ./... | grep -v /vendor/ | grep -v /tests)
TAGS ?= netgo

.PHONY: all
all: clean test build
all: clean test build buildarm

.PHONY: clean
clean:
$(GO) clean -i ./...
find . -type f -name "coverage.out" -delete
if [ -f Dockerfile ]; then rm Dockerfile ; fi

.PHONY: fmt
fmt:
Expand Down Expand Up @@ -66,8 +68,30 @@ megacheck:
test:
STATUS=0; for PKG in $(PACKAGES); do go test -cover -coverprofile $$GOPATH/src/$$PKG/coverage.out $$PKG || STATUS=1; done; exit $$STATUS

.PHONY: build
build: $(EXECUTABLE)-$(GOOS)-$(GOARCH)

$(EXECUTABLE)-$(GOOS)-$(GOARCH): $(wildcard *.go)
.PHONE: buildlinux
buildlinux:
$(GO) build -tags '$(TAGS)' -ldflags '-s -w $(GOLDFLAGS)' -o $(EXECUTABLE)

.PHONY: buildarm
buildarm:
$(GOARM) build -tags '$(TAGS)' -ldflags '-s -w $(GOLDFLAGS)' -o $(EXECUTABLE)

.PHONY: build
build: buildlinux buildarm

.PHONY: releaseamd64
releaseamd64:
if [ -f Dockerfile ]; then rm Dockerfile ; fi
ln -s DockerfileAMD Dockerfile
docker build . -t pcarranza/github-releases-notifier:latest
docker push pcarranza/github-releases-notifier:latest

.PHONY: releasearm
releasearm:
if [ -f Dockerfile ]; then rm Dockerfile ; fi
ln -s DockerfileARM Dockerfile
docker build . -t pcarranza/github-releases-notifier-armv6:latest
docker tag pcarranza/github-releases-notifier-armv6:latest \
pcarranza/github-releases-notifier-armv6:$(VERSION)
docker push pcarranza/github-releases-notifier-armv6:latest
docker push pcarranza/github-releases-notifier-armv6:$(VERSION)