Dockerfile (#269)
Provide docker images for go-toml tools. Ref: https://github.com/pelletier/go-toml/pull/267
This commit is contained in:
@@ -88,6 +88,28 @@ jobs:
|
|||||||
command: |
|
command: |
|
||||||
curl https://codecov.io/bash > codecov.sh
|
curl https://codecov.io/bash > codecov.sh
|
||||||
bash codecov.sh -v
|
bash codecov.sh -v
|
||||||
|
docker:
|
||||||
|
docker:
|
||||||
|
- image: "circleci/golang:1.12"
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- setup_remote_docker:
|
||||||
|
docker_layer_caching: true
|
||||||
|
- run: docker build -t pelletier/go-toml:$CIRCLE_SHA1 .
|
||||||
|
- run: docker login -u $DOCKER_USER -p $DOCKER_PASS
|
||||||
|
- run:
|
||||||
|
name: "Publish docker image"
|
||||||
|
command: |
|
||||||
|
IMAGE_NAME="pelletier/go-toml"
|
||||||
|
IMAGE_SHA_TAG="${IMAGE_NAME}:$CIRCLE_SHA1"
|
||||||
|
if [ "${CIRCLE_BRANCH}" = "master" ]; then
|
||||||
|
docker tag ${IMAGE_SHA_TAG} ${IMAGE_NAME}:latest
|
||||||
|
docker push ${IMAGE_NAME}:latest
|
||||||
|
fi
|
||||||
|
if [ "${CIRCLE_TAG}" != "" ]; then
|
||||||
|
docker tag ${IMAGE_SHA_TAG} ${IMAGE_NAME}:${CIRCLE_TAG}
|
||||||
|
docker push ${IMAGE_NAME}:${CIRCLE_TAG}
|
||||||
|
fi
|
||||||
|
|
||||||
workflows:
|
workflows:
|
||||||
version: 2.1
|
version: 2.1
|
||||||
@@ -138,3 +160,6 @@ workflows:
|
|||||||
requires:
|
requires:
|
||||||
- go1_11
|
- go1_11
|
||||||
- go1_12
|
- go1_12
|
||||||
|
- docker:
|
||||||
|
requires:
|
||||||
|
- codecov
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
cmd/tomll/tomll
|
||||||
|
cmd/tomljson/tomljson
|
||||||
@@ -1,2 +1,5 @@
|
|||||||
test_program/test_program_bin
|
test_program/test_program_bin
|
||||||
fuzz/
|
fuzz/
|
||||||
|
cmd/tomll/tomll
|
||||||
|
cmd/tomljson/tomljson
|
||||||
|
cmd/tomltestgen/tomltestgen
|
||||||
|
|||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
FROM golang:1.12-alpine3.9 as builder
|
||||||
|
WORKDIR /go/src/github.com/pelletier/go-toml
|
||||||
|
COPY . .
|
||||||
|
ENV CGO_ENABLED=0
|
||||||
|
ENV GOOS=linux
|
||||||
|
RUN go install ./...
|
||||||
|
|
||||||
|
FROM scratch
|
||||||
|
COPY --from=builder /go/bin/tomll /usr/bin/tomll
|
||||||
|
COPY --from=builder /go/bin/tomljson /usr/bin/tomljson
|
||||||
@@ -101,6 +101,23 @@ Go-toml provides two handy command line tools:
|
|||||||
tomljson --help
|
tomljson --help
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Docker image
|
||||||
|
|
||||||
|
Those tools are also availble as a Docker image from
|
||||||
|
[dockerhub](https://hub.docker.com/r/pelletier/go-toml). For example, to
|
||||||
|
use `tomljson`:
|
||||||
|
|
||||||
|
```
|
||||||
|
docker run -v $PWD:/workdir pelletier/go-toml tomljson /workdir/example.toml
|
||||||
|
```
|
||||||
|
|
||||||
|
Only master (`latest`) and tagged versions are published to dockerhub. You
|
||||||
|
can build your own image as usual:
|
||||||
|
|
||||||
|
```
|
||||||
|
docker build -t go-toml .
|
||||||
|
```
|
||||||
|
|
||||||
## Contribute
|
## Contribute
|
||||||
|
|
||||||
Feel free to report bugs and patches using GitHub's pull requests system on
|
Feel free to report bugs and patches using GitHub's pull requests system on
|
||||||
|
|||||||
Reference in New Issue
Block a user