add docker build on github, get rid of gitlab

This commit is contained in:
Thomas Quandalle
2022-08-09 12:00:11 +02:00
parent 5631947474
commit d4af376ad5
2 changed files with 28 additions and 72 deletions

28
.github/workflows/docker.yml vendored Normal file
View File

@@ -0,0 +1,28 @@
name: Docker Production build
on:
push:
branches: [ master ]
jobs:
build-amd64:
runs-on: ubuntu-latest
strategy:
matrix:
architecture: [amd64]
steps:
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Run Buildx
run: docker buildx build --platform linux/${{matrix.architecture}} -t kerberos/documentation:$(echo $GITHUB_SHA | cut -c1-7) --push .

View File

@@ -1,72 +0,0 @@
image: monachus/hugo
variables:
GIT_SUBMODULE_STRATEGY: recursive
ARTIFACT_NAME: documentation
REPO_NAME: kerberos-io/${ARTIFACT_NAME}
REPO_DIR: gitlab.com/${REPO_NAME}
CI_VERSION: "1.0.${CI_PIPELINE_ID}"
DOCKER_HOST: tcp://localhost:2375
NAMESPACE: kerberos
REGISTRY: registry.gitlab.com/kerberos-io/${ARTIFACT_NAME}
stages:
- build-staging # Staging environment -> develop
- build-production # Production environment -> master
- docker # All branches
- kubernetes-staging # Staging environment -> develop
- kubernetes-production # Production environment -> master
build-staging:
image: node:10.22.1
stage: build-staging
script:
- yarn
- yarn run build-staging
artifacts:
paths:
- public
except:
- master
build-production:
image: node:10.22.1
stage: build-production
script:
- yarn
- yarn run build
artifacts:
paths:
- public
only:
- master
docker:
image: docker:stable
stage: docker
services:
- docker:18.09.7-dind
script:
- docker login -u ${gitlab_id} -p ${gitlab_token} $CI_REGISTRY
- docker build --build-arg gitlab_id=${gitlab_id} --build-arg gitlab_token=${gitlab_token} -t $CI_REGISTRY/$REPO_NAME:$CI_VERSION .
- docker push $CI_REGISTRY/$REPO_NAME:$CI_VERSION
kubernetes-staging:
image: registry.cn-hangzhou.aliyuncs.com/haoshuwei24/kubectl:1.16.6
stage: kubernetes-staging
environment:
name: staging
script:
- kubectl patch deployment kerberos-documentation --patch="{\"spec\":{\"template\":{\"spec\":{\"containers\":[{\"name\":\"kerberos-documentation\",\"image\":\"${REGISTRY}:${CI_VERSION}\"}]}}}}" -n kerberos-ecosystem
except:
- master
kubernetes-production:
image: registry.cn-hangzhou.aliyuncs.com/haoshuwei24/kubectl:1.16.6
stage: kubernetes-production
environment:
name: production
script:
- kubectl patch deployment kerberos-documentation --patch="{\"spec\":{\"template\":{\"spec\":{\"containers\":[{\"name\":\"kerberos-documentation\",\"image\":\"${REGISTRY}:${CI_VERSION}\"}]}}}}" -n kerberos-ecosystem
only:
- master