Merge pull request #3 from josebarn/pr-publish
PR - adding dockerfile and public publish
This commit is contained in:
13
.drone.yml
13
.drone.yml
@@ -3,10 +3,19 @@ pipeline:
|
|||||||
image: ${IMAGE}
|
image: ${IMAGE}
|
||||||
commands:
|
commands:
|
||||||
- go build
|
- go build
|
||||||
|
|
||||||
|
test:
|
||||||
|
image: ${IMAGE}
|
||||||
|
commands:
|
||||||
- go test
|
- go test
|
||||||
|
|
||||||
|
publish:
|
||||||
|
image: plugins/docker
|
||||||
|
repo: josebarn/hello-world
|
||||||
|
tags: [ 1.0.0, 1.0, latest ]
|
||||||
|
dockerfile: ./docker/Dockerfile
|
||||||
|
secrets: [ DOCKER_USERNAME, DOCKER_PASSWORD ]
|
||||||
|
debug: true
|
||||||
matrix:
|
matrix:
|
||||||
IMAGE:
|
IMAGE:
|
||||||
- golang:1.7
|
|
||||||
- golang:1.8
|
|
||||||
- golang:latest
|
- golang:latest
|
||||||
|
|||||||
1
.drone.yml.sig
Normal file
1
.drone.yml.sig
Normal file
@@ -0,0 +1 @@
|
|||||||
|
eyJhbGciOiJIUzI1NiJ9.cGlwZWxpbmU6CiAgYnVpbGQ6CiAgICBpbWFnZTogJHtJTUFHRX0KICAgIGNvbW1hbmRzOgogICAgICAtIGdvIGJ1aWxkCgogIHRlc3Q6CiAgICBpbWFnZTogJHtJTUFHRX0KICAgIGNvbW1hbmRzOgogICAgICAtIGdvIHRlc3QKCiAgcHVibGlzaDoKICAgIGltYWdlOiBwbHVnaW5zL2RvY2tlcgogICAgcmVwbzogam9zZWJhcm4vaGVsbG8td29ybGQKICAgIHRhZ3M6IFsgMS4wLjAsIDEuMCwgbGF0ZXN0IF0KICAgIGRvY2tlcmZpbGU6IC4vZG9ja2VyL0RvY2tlcmZpbGUKICAgIHNlY3JldHM6IFsgRE9DS0VSX1VTRVJOQU1FLCBET0NLRVJfUEFTU1dPUkQgXQogICAgZGVidWc6IHRydWUKbWF0cml4OgogIElNQUdFOgogICAgLSBnb2xhbmc6bGF0ZXN0Cg.KhxWXgdGcJHCk-aDcSx9GEphLCIMEFe2vg0EpYWUlBI
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
# drone-with-go [](http://beta.drone.io/drone-demos/drone-with-go) [](https://aircover.co/drone-demos/drone-with-go)
|
# drone-with-go [](https://ci.cloudlockng.com/josebarn/drone-with-go)
|
||||||
|
|
||||||
An example of how to test Go code with Drone.
|
An example of how to test Go code with Drone.
|
||||||
|
|
||||||
Inspect the .drone.yml file for details on the build steps for this simple go project.
|
Inspect the .drone.yml file for details on the build steps for this simple go project.
|
||||||
|
|
||||||
|
Notice the .drone.sig is used to ensure secrets are not exposed; and the pipeline is split into multiple phases.
|
||||||
|
|||||||
23
docker/Dockerfile
Normal file
23
docker/Dockerfile
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# Multi-stage build form
|
||||||
|
FROM golang:latest
|
||||||
|
|
||||||
|
# Copy in code...
|
||||||
|
RUN mkdir /app
|
||||||
|
ADD main.go /app/
|
||||||
|
|
||||||
|
# Build app
|
||||||
|
WORKDIR /app
|
||||||
|
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o hello .
|
||||||
|
|
||||||
|
# Could use something even smaller...
|
||||||
|
FROM alpine:latest
|
||||||
|
RUN apk --no-cache add ca-certificates
|
||||||
|
|
||||||
|
RUN mkdir /app
|
||||||
|
WORKDIR /app/
|
||||||
|
COPY --from=0 /app/hello .
|
||||||
|
|
||||||
|
# Expose ports for future REST Interface
|
||||||
|
EXPOSE 8080
|
||||||
|
|
||||||
|
CMD ["/app/hello"]
|
||||||
Reference in New Issue
Block a user