Skip to content
This repository has been archived by the owner on May 16, 2022. It is now read-only.

Commit

Permalink
Add docker image build step
Browse files Browse the repository at this point in the history
  • Loading branch information
skolodyazhnyy committed Aug 24, 2019
1 parent 7425245 commit b438b40
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 7 deletions.
52 changes: 45 additions & 7 deletions .drone.yml
Expand Up @@ -10,7 +10,7 @@ image_pull_secrets:
- docker_registry

steps:
- name: install
- name: dep
image: mcom/gobuilder:1.12
pull: always
commands: [ "make dep" ]
Expand Down Expand Up @@ -38,12 +38,25 @@ trigger:
status: [ "success"]

steps:
- name: install
- name: dep
image: mcom/gobuilder:1.12
pull: always
commands: [ "make dep" ]

- name: build
- name: build linux
image: mcom/gobuilder:1.12
pull: always
commands: [ "make build" ]
environment:
BUILDARGS: -a -installsuffix cgo
BUILDCOMMIT: ${DRONE_COMMIT_SHA:0:7}
BUILDLDFLAGS: -extldflags "-static"
BUILDOUTPREFIX: build/linux-amd64/
BUILDTAG: ${DRONE_TAG}
GOARCH: amd64
GOOS: linux

- name: build darwin
image: mcom/gobuilder:1.12cross
pull: always
commands: [ "make build" ]
Expand All @@ -57,17 +70,28 @@ steps:
GOARCH: amd64
GOOS: darwin

- name: pack
image: mcom/gobuilder:1.12
- name: pack tarball
image: mcom/zipbuilder
pull: always
commands: [ "tar -C build/darwin-amd64 -cvzf go-starter-darwin-amd64.tgz ." ]
commands:
- "tar -C build/darwin-amd64 -cvzf go-starter-darwin-amd64.tgz ."
- "tar -C build/linux-amd64 -cvzf go-starter-linux-amd64.tgz ."

- name: docker image
image: plugins/docker:latest
settings:
username: { from_secret: docker_username }
password: { from_secret: docker_password }
repo: mcom/gostarter
tags: [ "${DRONE_TAG=latest}", "${DRONE_COMMIT_SHA:0:7}" ]

- name: release
- name: github release
image: socialengine/github-release
pull: always
commands:
- github-release release --user magento-mcom --repo go-starter --tag ${DRONE_TAG} --name ${DRONE_TAG}
- github-release upload --user magento-mcom --repo go-starter --tag ${DRONE_TAG} --name go-starter-darwin-amd64.tgz --file ./go-starter-darwin-amd64.tgz
- github-release upload --user magento-mcom --repo go-starter --tag ${DRONE_TAG} --name go-starter-linux-amd64.tgz --file ./go-starter-linux-amd64.tgz
environment:
GITHUB_RELEASE_VERSION: v0.7.2
GITHUB_TOKEN: { from_secret: github_token }
Expand All @@ -91,6 +115,20 @@ get:
path: secret/dx_magento_mom_droneci/registry/docker.io
name: config

---
kind: secret
name: docker_username
get:
path: secret/dx_magento_mom_droneci/registry/docker.io
name: username

---
kind: secret
name: docker_password
get:
path: secret/dx_magento_mom_droneci/registry/docker.io
name: password

---
kind: secret
name: github_token
Expand Down
7 changes: 7 additions & 0 deletions Dockerfile
@@ -0,0 +1,7 @@
FROM alpine:3.7

RUN apk -U add ca-certificates

ADD build/linux-amd64 /bin/

ENTRYPOINT [ "go-starter" ]

0 comments on commit b438b40

Please sign in to comment.