-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from zhangzerui20/main
update workflows
- Loading branch information
Showing
5 changed files
with
70 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: DockerImage | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
polaris_controller_tag: | ||
description: 'tag for polaris-controller' | ||
required: true | ||
docker_username: | ||
description: 'docker username for login' | ||
required: true | ||
docker_password: | ||
description: 'docker password for login' | ||
required: true | ||
|
||
jobs: | ||
release: | ||
name: Release Polaris Docker Image | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
goos: [linux] | ||
goarch: [amd64] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ github.event.inputs.polaris_tag }} | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.16.5 | ||
|
||
- name: Build | ||
id: build | ||
env: | ||
DOCKER_TAG: ${{ github.event.inputs.polaris_controller_tag }} | ||
DOCKER_USER: ${{ github.event.inputs.docker_username }} | ||
DOCKER_PASS: ${{ github.event.inputs.docker_password }} | ||
run: | | ||
make push-image REPO=polarismesh/polaris-controller IMAGE_TAG=${DOCKER_TAG} DOCKER_USER=${DOCKER_USER} DOCKER_PASS=${DOCKER_PASS} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,17 @@ | ||
.PHONY: build | ||
|
||
REGISTRY = docker.io | ||
REPO = polaris_mesh_test/polaris-controller | ||
IMAGE_TAG = v1.0.0 | ||
|
||
build: | ||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o ./bin/polaris-controller ./cmd/polaris-controller/main.go | ||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o ./bin/polaris-controller ./cmd/polaris-controller/main.go | ||
|
||
build-image: | ||
docker build . -f ./docker/Dockerfile -t $(REGISTRY)/$(REPO):$(IMAGE_TAG) | ||
|
||
push-image: build build-image login | ||
docker push $(REGISTRY)/$(REPO):$(IMAGE_TAG) | ||
|
||
login: | ||
@docker login --username=$(DOCKER_USER) --password=$(DOCKER_PASS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
FROM alpine:latest | ||
RUN apk update \ | ||
&& apk add tzdata \ | ||
&& apk add --no-cache bash \ | ||
&& apk add curl \ | ||
&& cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \ | ||
&& echo "Asia/Shanghai" > /etc/timezone | ||
|
||
RUN mkdir -p /polaris-controller/log && \ | ||
chmod -R 755 /polaris-controller | ||
|
||
WORKDIR /polaris-controller | ||
COPY ../bin/polaris-controller /polaris-controller/polaris-controller | ||
|
||
ENTRYPOINT ["/polaris-controller/polaris-controller"] | ||
COPY ./bin/polaris-controller /polaris-controller/polaris-controller | ||
COPY ./docker/polaris.yaml /polaris-controller/polaris.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
global: | ||
serverConnector: | ||
addresses: | ||
- 127.0.0.2:8091 |