diff --git a/.circleci/config.yml b/.circleci/config.yml index 5154b28..4991560 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,11 +1,13 @@ version: 2 jobs: + build: docker: - image: golang working_directory: /go/src/github.com/raviqqe/liche steps: - checkout + - setup_remote_docker - run: name: Setup command: | @@ -32,3 +34,21 @@ jobs: - run: name: Install command: rake install + - persist_to_workspace: + root: . + paths: [ bin/liche, Dockerfile.test ] + + docker: + docker: + - image: docker:17.05.0-ce-git + steps: + - attach_workspace: { at: . } + - setup_remote_docker + - run: docker build -f Dockerfile.test -t raviqqe/docker-liche:latest . + +workflows: + version: 2 + build: + jobs: + - build + - docker: { requires: [ build ] } diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9ff7dfd --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM golang:latest +RUN CGO_ENABLED=0 GOOS=linux go get -u github.com/raviqqe/liche + +FROM alpine:latest +RUN apk --no-cache add ca-certificates +WORKDIR /root/ +COPY --from=0 /go/bin/liche /go/bin/liche +ENV PATH "/go/bin:$PATH" +RUN liche --help +CMD liche diff --git a/Dockerfile.test b/Dockerfile.test new file mode 100644 index 0000000..f03dcee --- /dev/null +++ b/Dockerfile.test @@ -0,0 +1,7 @@ +FROM alpine:latest +RUN apk --no-cache add ca-certificates +WORKDIR /root/ +ADD bin/liche /go/bin/liche +ENV PATH "/go/bin:$PATH" +RUN liche --help +CMD liche diff --git a/rakefile.rb b/rakefile.rb index d75e3ec..81d4360 100644 --- a/rakefile.rb +++ b/rakefile.rb @@ -9,7 +9,7 @@ task :deps do end task :build do - sh 'go build -o bin/liche' + sh 'CGO_ENABLED=0 GOOS=linux go build -o bin/liche' end task :fast_unit_test do