Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
octu0 committed Mar 23, 2021
0 parents commit dec8cb1
Show file tree
Hide file tree
Showing 99 changed files with 8,245 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.out
/Halide-Runtime
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.swp
.DS_Store

*.out
/Halide-Runtime
50 changes: 50 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# syntax=docker/dockerfile:experimental
FROM golang:1.16-alpine as goget

COPY go.mod go.sum /go/src/github.com/octu0/blurry/

RUN set -eux && \
apk add --no-cache --virtual .build-deps git wget openssh-client && \
cd /go/src/github.com/octu0/blurry && \
go mod download && \
apk del .build-deps

# ----------------------------------
FROM golang:1.16 as builder
COPY --from=goget /go/bin/ /go/bin/
COPY --from=goget /go/src/ /go/src/
COPY --from=goget /go/pkg/ /go/pkg/

WORKDIR /build

ADD . /go/src/github.com/octu0/blurry/

RUN set -eux && \
apt-get clean && \
apt-get update -y && \
apt-get install -y gcc libc-dev libc++-dev g++ clang wget libtinfo5 libclang-dev

RUN set -eux && \
cd /go/src/github.com/octu0/blurry && \
GOOS=linux GOARCH=amd64 go build -o /build/blurry \
cmd/bridge/main.go \
&& \
/build/blurry --version

RUN set -eux && \
apt-get remove -y gcc libc-dev && \
apt-get purge -y && \
apt-get autoclean

# ----------------------------------

FROM golang:1.16

WORKDIR /app
COPY --from=builder /build/blurry /app

RUN set -eux && \
/app/blurry --version

COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
ENTRYPOINT [ "docker-entrypoint.sh" ]
18 changes: 18 additions & 0 deletions Dockerfile.generator
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM ubuntu:20.04 as halide-runtime

WORKDIR /halide

RUN set -eux && \
apt update && \
apt install -y wget && \
wget https://github.com/halide/Halide/releases/download/v11.0.1/Halide-11.0.1-x86-64-linux-85c1b91c47ce15aab0d9502d955e48615f3bcee0.tar.gz && \
tar xzf Halide-11.0.1-x86-64-linux-85c1b91c47ce15aab0d9502d955e48615f3bcee0.tar.gz && \
rm Halide-11.0.1-x86-64-linux-85c1b91c47ce15aab0d9502d955e48615f3bcee0.tar.gz && \
mv Halide-11.0.1-x86-64-linux Halide-Runtime

RUN set -eux && \
apt update && \
apt install -y clang g++ binutils libpng-dev libjpeg-dev

COPY docker-entrypoint.generator.sh /usr/local/bin/docker-entrypoint.generator.sh
ENTRYPOINT [ "docker-entrypoint.generator.sh" ]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Yusuke Hata

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
56 changes: 56 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
VERSION_GO = version.go

_NAME = $(shell grep -o 'AppName string = "[^"]*"' $(VERSION_GO) | cut -d '"' -f2)
_VERSION = $(shell grep -oE 'Version string = "[0-9]+\.[0-9]+\.[0-9]+"' $(VERSION_GO) | cut -d '"' -f2)

_HALIDE = "generator"
_HALIDE_VER = "11.0.1"

.PHONY: vet
vet:
go vet ./

.PHONY: test
test:
go test -v ./...

ifeq ($(shell uname),Darwin)
.PHONY: setup-halide
setup-halide:
brew install halide

.PHONY: setup-halide-runtime
setup-halide-runtime:
ifeq ($(shell [ -d ./Halide-Runtime ] && echo "1"),1)
@echo "./Halide-Runtime exists"
else
curl -O -sSL https://github.com/halide/Halide/releases/download/v11.0.1/Halide-11.0.1-x86-64-osx-85c1b91c47ce15aab0d9502d955e48615f3bcee0.tar.gz
tar xzf Halide-11.0.1-x86-64-osx-85c1b91c47ce15aab0d9502d955e48615f3bcee0.tar.gz
mv Halide-11.0.1-x86-64-osx ./Halide-Runtime
rm Halide-11.0.1-x86-64-osx-85c1b91c47ce15aab0d9502d955e48615f3bcee0.tar.gz
endif
endif

.PHONY: build-generator
build-generator:
docker build -f Dockerfile.generator -t $(_HALIDE):$(_HALIDE_VER) .
docker tag $(_HALIDE):$(_HALIDE_VER) $(_NAME):latest

.PHONY: generate
generate: build-generator
docker run --rm \
-v $(PWD):/app -v $(PWD):/out $(_HALIDE):$(_HALIDE_VER)

.PHONY: build
build:
docker build -t $(_NAME):$(_VERSION) .
docker tag $(_NAME):$(_VERSION) $(_NAME):latest

.PHONY: ghpkg
ghpkg:
docker tag $(_NAME):$(_VERSION) docker.pkg.github.com/octu0/blurry/$(_NAME):$(_VERSION)
docker push docker.pkg.github.com/octu0/blurry/$(_NAME):$(_VERSION)

.PHONY: prune
prune:
docker builder prune
Loading

0 comments on commit dec8cb1

Please sign in to comment.