Skip to content

Commit

Permalink
Merge pull request #122 from zheng1/feat_github_actions
Browse files Browse the repository at this point in the history
Add dockerfile && github actions auto push docker image
  • Loading branch information
zheng1 committed Aug 28, 2020
2 parents aa6b13b + a34e98c commit c78d26e
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Docker

on:
push:
branches: [ master ]
tags: ['*']

jobs:

build:
name: Build
runs-on: ubuntu-latest
steps:

- name: Check out code
uses: actions/checkout@v2

- name: Build and push Docker images
uses: docker/build-push-action@v1.1.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
repository: kubesphere/porter
dockerfile: ./Dockerfile
tag_with_ref: true
push: true
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2020 The KubeSphere Authors. All rights reserved.
# Use of this source code is governed by an Apache license
# that can be found in the LICENSE file.

FROM golang:1.15 as porter-builder

COPY / /go/src/github.com/kubesphere/porter

WORKDIR /go/src/github.com/kubesphere/porter
RUN GO111MODULE=on CGO_ENABLED=0 go install -i -ldflags '-w -s' github.com/kubesphere/porter/cmd/...

FROM alpine:3.9
RUN apk add --update ca-certificates && update-ca-certificates
COPY --from=porter-builder /go/bin/agent /usr/local/bin/
COPY --from=porter-builder /go/bin/manager /usr/local/bin/
CMD ["sh"]

0 comments on commit c78d26e

Please sign in to comment.