Browse Source

Publish Docker image

renovate/configure
Yota Toyama 7 years ago
parent
commit
597d3b32b0
  1. 70
      .circleci/config.yml
  2. 15
      Dockerfile
  3. 7
      Dockerfile.test

70
.circleci/config.yml

@ -1,4 +1,12 @@
version: 2 version: 2
workflows:
version: 2
all:
jobs:
- build
- docker:
requires:
- build
jobs: jobs:
build: build:
docker: docker:
@ -6,48 +14,38 @@ jobs:
working_directory: /go/src/github.com/raviqqe/liche working_directory: /go/src/github.com/raviqqe/liche
steps: steps:
- checkout - checkout
- setup_remote_docker - run: |
- run:
name: Setup
command: |
apt -y update --fix-missing apt -y update --fix-missing
apt -y install rake
apt -y install bundler rake apt -y install bundler rake
- run: - run: rake deps
name: Dependencies - run: rake lint
command: rake deps - run: rake build
- run: - run: rake unit_test
name: Lint - run: curl -sSL https://codecov.io/bash | bash
command: rake lint - run: rake integration_test
- run: - run: rake install
name: Unit Test - run: ./liche --version > version
command: |
rake unit_test
curl -sSL https://codecov.io/bash | bash
- run:
name: Integration Test
command: rake integration_test
- run:
name: Build
command: rake build
- run:
name: Install
command: rake install
- persist_to_workspace: - persist_to_workspace:
root: . root: .
paths: [bin/liche, Dockerfile.test] paths:
- version
docker: docker:
docker: docker:
- image: docker:17.05.0-ce-git - image: docker:17
steps: steps:
- attach_workspace: { at: . }
- setup_remote_docker - setup_remote_docker
- run: docker build -f Dockerfile.test -t raviqqe/docker-liche:latest . - checkout
- attach_workspace:
at: .
- run: |
name=$DOCKER_USER/liche
version=$(cat version)
workflows: if [ $CIRCLE_BRANCH = master -a $version != $(docker run $name --version) ]
version: 2 then
build: docker build -t $name .
jobs: docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
- build docker push $name
- docker: { requires: [build] } docker tag $name $name:$version
docker push $name:$version
fi

15
Dockerfile

@ -1,10 +1,9 @@
FROM golang:latest FROM golang
RUN CGO_ENABLED=0 GOOS=linux go get -u github.com/raviqqe/liche COPY . /go/src/github.com/raviqqe/liche
WORKDIR /go/src/github.com/raviqqe/liche
RUN CGO_ENABLED=0 GOOS=linux go get .
FROM alpine:latest FROM alpine
RUN apk --no-cache add ca-certificates RUN apk --no-cache add ca-certificates
WORKDIR /root/ COPY --from=0 /go/bin/liche /liche
COPY --from=0 /go/bin/liche /go/bin/liche ENTRYPOINT ["/liche"]
ENV PATH "/go/bin:$PATH"
RUN liche --help
CMD liche

7
Dockerfile.test

@ -1,7 +0,0 @@
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
Loading…
Cancel
Save