general: move Docker image build to GitHub Actions
This commit is contained in:
parent
81acde3a37
commit
a48f1c8040
@ -1,127 +0,0 @@
|
||||
version: 2.1
|
||||
|
||||
workflows:
|
||||
docker:
|
||||
jobs:
|
||||
- build
|
||||
- docker-frontend-deploy:
|
||||
context:
|
||||
- docker
|
||||
requires:
|
||||
- build
|
||||
filters:
|
||||
branches:
|
||||
only: master
|
||||
- docker-proxy-deploy:
|
||||
context:
|
||||
- docker
|
||||
requires:
|
||||
- build
|
||||
filters:
|
||||
branches:
|
||||
only: master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
docker:
|
||||
- image: cimg/go:1.17
|
||||
working_directory: /home/circleci/go/src/github.com/xddxdd/bird-lg-go
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Test frontend
|
||||
command: |
|
||||
export GO111MODULE=on
|
||||
cd frontend
|
||||
go get -v -t -d ./...
|
||||
go test -v ./...
|
||||
- run:
|
||||
name: Test proxy
|
||||
command: |
|
||||
export GO111MODULE=on
|
||||
cd proxy
|
||||
go get -v -t -d ./...
|
||||
go test -v ./...
|
||||
|
||||
docker-frontend-deploy:
|
||||
machine:
|
||||
image: ubuntu-2004:202111-02
|
||||
environment:
|
||||
BUILDX_PLATFORMS: linux/amd64,linux/arm64,linux/386,linux/arm/v7
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Install buildx
|
||||
command: |
|
||||
BUILDX_BINARY_URL="https://github.com/docker/buildx/releases/download/v0.7.1/buildx-v0.7.1.linux-amd64"
|
||||
|
||||
curl --output docker-buildx \
|
||||
--silent --show-error --location --fail --retry 3 \
|
||||
"$BUILDX_BINARY_URL"
|
||||
|
||||
mkdir -p ~/.docker/cli-plugins
|
||||
|
||||
mv docker-buildx ~/.docker/cli-plugins/
|
||||
chmod a+x ~/.docker/cli-plugins/docker-buildx
|
||||
|
||||
docker buildx install
|
||||
# Run binfmt
|
||||
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
||||
- run:
|
||||
name: Build Docker image
|
||||
environment:
|
||||
BUILD_ID: << pipeline.number >>
|
||||
command: |
|
||||
echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin
|
||||
docker buildx create --name mybuilder --use
|
||||
docker buildx build \
|
||||
--platform $BUILDX_PLATFORMS \
|
||||
-t $DOCKER_USERNAME/bird-lg-go:circleci-build$BUILD_ID \
|
||||
--progress plain \
|
||||
--push frontend
|
||||
docker buildx build \
|
||||
--platform $BUILDX_PLATFORMS \
|
||||
-t $DOCKER_USERNAME/bird-lg-go:latest \
|
||||
--progress plain \
|
||||
--push frontend
|
||||
|
||||
docker-proxy-deploy:
|
||||
machine:
|
||||
image: ubuntu-2004:202111-02
|
||||
environment:
|
||||
BUILDX_PLATFORMS: linux/amd64,linux/arm64,linux/386,linux/arm/v7
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Install buildx
|
||||
command: |
|
||||
BUILDX_BINARY_URL="https://github.com/docker/buildx/releases/download/v0.7.1/buildx-v0.7.1.linux-amd64"
|
||||
|
||||
curl --output docker-buildx \
|
||||
--silent --show-error --location --fail --retry 3 \
|
||||
"$BUILDX_BINARY_URL"
|
||||
|
||||
mkdir -p ~/.docker/cli-plugins
|
||||
|
||||
mv docker-buildx ~/.docker/cli-plugins/
|
||||
chmod a+x ~/.docker/cli-plugins/docker-buildx
|
||||
|
||||
docker buildx install
|
||||
# Run binfmt
|
||||
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
||||
- run:
|
||||
name: Build Docker image
|
||||
environment:
|
||||
BUILD_ID: << pipeline.number >>
|
||||
command: |
|
||||
echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin
|
||||
docker buildx create --name mybuilder --use
|
||||
docker buildx build \
|
||||
--platform $BUILDX_PLATFORMS \
|
||||
-t $DOCKER_USERNAME/bird-lgproxy-go:circleci-build$BUILD_ID \
|
||||
--push proxy
|
||||
docker buildx build \
|
||||
--platform $BUILDX_PLATFORMS \
|
||||
-t $DOCKER_USERNAME/bird-lgproxy-go:latest \
|
||||
--progress plain \
|
||||
--push proxy
|
38
.github/workflows/docker-develop.yaml
vendored
Normal file
38
.github/workflows/docker-develop.yaml
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '**'
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Build frontend docker image
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: '{{defaultContext}}:frontend'
|
||||
push: true
|
||||
tags: |
|
||||
xddxdd/bird-lg-go:develop
|
||||
xddxdd/bird-lg-go:develop-${{ github.sha }}
|
||||
|
||||
- name: Build proxy docker image
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: '{{defaultContext}}:proxy'
|
||||
push: true
|
||||
tags: |
|
||||
xddxdd/bird-lgproxy-go:develop
|
||||
xddxdd/bird-lgproxy-go:develop-${{ github.sha }}
|
35
.github/workflows/docker-release.yaml
vendored
Normal file
35
.github/workflows/docker-release.yaml
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
on:
|
||||
release:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Build frontend docker image
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: '{{defaultContext}}:frontend'
|
||||
push: true
|
||||
tags: |
|
||||
xddxdd/bird-lg-go:latest
|
||||
|
||||
- name: Build proxy docker image
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: '{{defaultContext}}:proxy'
|
||||
push: true
|
||||
tags: |
|
||||
xddxdd/bird-lgproxy-go:latest
|
Loading…
x
Reference in New Issue
Block a user