Init
This commit is contained in:
commit
f90fdc0598
99 changed files with 15260 additions and 0 deletions
14
.gitlab/_common.gitlab-ci.yml
Normal file
14
.gitlab/_common.gitlab-ci.yml
Normal file
|
@ -0,0 +1,14 @@
|
|||
variables:
|
||||
LATEST_IMAGE: '$CI_REGISTRY_IMAGE:latest'
|
||||
DOCKER_VERSION: '24.0.2'
|
||||
GOLANG_VERSION: '1.20'
|
||||
NODE_VERSION: '18'
|
||||
ALPINE_VERSION: '3'
|
||||
DEBIAN_VERSION: '12'
|
||||
TELEPORT_VERSION: '13.1.1'
|
||||
|
||||
image: docker:$DOCKER_VERSION-git
|
||||
|
||||
.login_registry:
|
||||
before_script:
|
||||
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
17
.gitlab/_rules.gitlab-ci.yml
Normal file
17
.gitlab/_rules.gitlab-ci.yml
Normal file
|
@ -0,0 +1,17 @@
|
|||
.if-release-candidate-tag: &if-release-candidate-tag
|
||||
if: '$CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]+/'
|
||||
|
||||
.if-stable-release-tag: &if-stable-release-tag
|
||||
if: '$CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/'
|
||||
|
||||
.if-default-branch: &if-default-branch
|
||||
if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
||||
|
||||
.rules:release:
|
||||
rules:
|
||||
- <<: *if-release-candidate-tag
|
||||
- <<: *if-stable-release-tag
|
||||
|
||||
.rules:default:
|
||||
rules:
|
||||
- <<: *if-default-branch
|
24
.gitlab/build.gitlab-ci.yml
Normal file
24
.gitlab/build.gitlab-ci.yml
Normal file
|
@ -0,0 +1,24 @@
|
|||
build_release:
|
||||
rules: !reference [.rules:release, rules]
|
||||
stage: build
|
||||
extends: .login_registry
|
||||
services:
|
||||
- name: docker:$DOCKER_VERSION-dind
|
||||
alias: docker
|
||||
variables:
|
||||
DOCKER_TLS_CERTDIR: '/certs'
|
||||
CURRENT_IMAGE: '$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG'
|
||||
script:
|
||||
- >
|
||||
docker build .
|
||||
--file docker/Dockerfile
|
||||
--build-arg GOLANG_VERSION=$GOLANG_VERSION
|
||||
--build-arg NODE_VERSION=$NODE_VERSION
|
||||
--build-arg ALPINE_VERSION=$ALPINE_VERSION
|
||||
--build-arg APP_VERSION=$CI_COMMIT_TAG
|
||||
--build-arg BUILD_TIME=$CI_JOB_STARTED_AT
|
||||
--tag $CURRENT_IMAGE
|
||||
--tag $LATEST_IMAGE
|
||||
- docker inspect $CURRENT_IMAGE
|
||||
- docker push $CURRENT_IMAGE
|
||||
- docker push $LATEST_IMAGE
|
18
.gitlab/deploy.gitlab-ci.yml
Normal file
18
.gitlab/deploy.gitlab-ci.yml
Normal file
|
@ -0,0 +1,18 @@
|
|||
deploy_release:
|
||||
rules: !reference [.rules:release, rules]
|
||||
stage: deploy
|
||||
image: debian:${DEBIAN_VERSION}-slim
|
||||
id_tokens:
|
||||
TBOT_GITLAB_JWT:
|
||||
aud: tp.fhoss.de
|
||||
script:
|
||||
- apt-get update && apt-get install curl -y
|
||||
- cd /tmp
|
||||
- 'curl -O https://cdn.teleport.dev/teleport-v${TELEPORT_VERSION}-linux-amd64-bin.tar.gz'
|
||||
- tar -xvf teleport-v${TELEPORT_VERSION}-linux-amd64-bin.tar.gz
|
||||
- ./teleport/install
|
||||
- 'tbot start --token=gitlab --destination-dir=/tmp/tbot-user --data-dir=/tmp/tbot-data --auth-server=tp.fhoss.de:443 --join-method=gitlab --oneshot'
|
||||
- 'tsh -i /tmp/tbot-user/identity --proxy tp.fhoss.de:443 ssh bot@cafe "docker compose -f /opt/docker/cafe/docker-compose.yml up -d --pull always"'
|
||||
- 'tsh -i /tmp/tbot-user/identity --proxy tp.fhoss.de:443 ssh bot@cafe "docker system prune --force"'
|
||||
environment:
|
||||
name: production
|
Loading…
Add table
Add a link
Reference in a new issue