Merge branch 'pipeline-refactoring' into 'dev'
Update CI images with digests and remove redundant declarations See merge request rheinsw/website!14
This commit is contained in:
@@ -24,6 +24,11 @@ variables:
|
|||||||
PROJECT_NAME: $CI_PROJECT_NAME
|
PROJECT_NAME: $CI_PROJECT_NAME
|
||||||
DOCKER_IMAGE: "registry.boomlab.party/rheinsw/$CI_PROJECT_NAME"
|
DOCKER_IMAGE: "registry.boomlab.party/rheinsw/$CI_PROJECT_NAME"
|
||||||
|
|
||||||
|
.deploy_production_rule: &deploy_production_rule
|
||||||
|
- if: $CI_COMMIT_BRANCH == "production"
|
||||||
|
when: manual
|
||||||
|
allow_failure: true
|
||||||
|
|
||||||
# Reusable SSH key setup block
|
# Reusable SSH key setup block
|
||||||
.install_deploy_key: &install_deploy_key
|
.install_deploy_key: &install_deploy_key
|
||||||
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
|
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
|
||||||
@@ -34,11 +39,6 @@ variables:
|
|||||||
- ssh-add ~/.ssh/deploy_key
|
- ssh-add ~/.ssh/deploy_key
|
||||||
- ssh-keyscan -p 22 -H '192.168.41.101' >> ~/.ssh/known_hosts || true
|
- ssh-keyscan -p 22 -H '192.168.41.101' >> ~/.ssh/known_hosts || true
|
||||||
|
|
||||||
.deploy_production_rule: &deploy_production_rule
|
|
||||||
- if: $CI_COMMIT_BRANCH == "production"
|
|
||||||
when: manual
|
|
||||||
allow_failure: true
|
|
||||||
|
|
||||||
.deploy_script: &deploy_script
|
.deploy_script: &deploy_script
|
||||||
- |
|
- |
|
||||||
echo "Deploying $DOCKER_IMAGE:$TAG to $CONTAINER_NAME on port $PORT..."
|
echo "Deploying $DOCKER_IMAGE:$TAG to $CONTAINER_NAME on port $PORT..."
|
||||||
@@ -61,26 +61,30 @@ build:
|
|||||||
dockerize:
|
dockerize:
|
||||||
stage: docker
|
stage: docker
|
||||||
image: docker:20.10@sha256:2967f0819c84dd589ed0a023b9d25dcfe7a3c123d5bf784ffbb77edf55335f0c
|
image: docker:20.10@sha256:2967f0819c84dd589ed0a023b9d25dcfe7a3c123d5bf784ffbb77edf55335f0c
|
||||||
services:
|
|
||||||
- docker:dind
|
|
||||||
before_script:
|
before_script:
|
||||||
- echo "$CI_REGISTRY_PASSWORD" | docker login "$CI_REGISTRY" -u "$CI_REGISTRY_USER" --password-stdin
|
- echo "$CI_REGISTRY_PASSWORD" | docker login "$CI_REGISTRY" -u "$CI_REGISTRY_USER" --password-stdin
|
||||||
script:
|
script:
|
||||||
- |
|
- |
|
||||||
if [[ "$CI_COMMIT_REF_NAME" == "production" ]]; then
|
TAG="$CI_COMMIT_REF_NAME"
|
||||||
TAG="latest"
|
echo "Building Docker image with tag: $TAG"
|
||||||
elif [[ "$CI_COMMIT_REF_NAME" == "dev" ]]; then
|
|
||||||
TAG="dev"
|
|
||||||
else
|
|
||||||
echo "Skipping Docker build for branch $CI_COMMIT_REF_NAME"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
echo "Using tag: $TAG"
|
|
||||||
docker build -t $DOCKER_IMAGE:$TAG -f Dockerfile .
|
docker build -t $DOCKER_IMAGE:$TAG -f Dockerfile .
|
||||||
|
|
||||||
|
if [[ "$TAG" == "dev" || "$TAG" == "production" ]]; then
|
||||||
|
echo "Pushing Docker image $DOCKER_IMAGE:$TAG"
|
||||||
docker push $DOCKER_IMAGE:$TAG
|
docker push $DOCKER_IMAGE:$TAG
|
||||||
only:
|
else
|
||||||
- dev
|
echo "Skipping Docker push for non-dev or production branch: $TAG"
|
||||||
- production
|
fi
|
||||||
|
|
||||||
|
deploy_production:
|
||||||
|
stage: deploy
|
||||||
|
rules: *deploy_production_rule
|
||||||
|
before_script: *install_deploy_key
|
||||||
|
script:
|
||||||
|
- TAG="production"
|
||||||
|
- PORT="4100"
|
||||||
|
- CONTAINER_NAME="$CI_PROJECT_NAME-production"
|
||||||
|
- *deploy_script
|
||||||
|
|
||||||
deploy_dev:
|
deploy_dev:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
@@ -93,16 +97,6 @@ deploy_dev:
|
|||||||
only:
|
only:
|
||||||
- dev
|
- dev
|
||||||
|
|
||||||
deploy_production:
|
|
||||||
stage: deploy
|
|
||||||
rules: *deploy_production_rule
|
|
||||||
before_script: *install_deploy_key
|
|
||||||
script:
|
|
||||||
- TAG="latest"
|
|
||||||
- PORT="4100"
|
|
||||||
- CONTAINER_NAME="$CI_PROJECT_NAME-production"
|
|
||||||
- *deploy_script
|
|
||||||
|
|
||||||
sync_branches:
|
sync_branches:
|
||||||
stage: sync
|
stage: sync
|
||||||
rules:
|
rules:
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ export default function Home() {
|
|||||||
/>
|
/>
|
||||||
<ol className="list-inside list-decimal text-sm/6 text-center sm:text-left font-[family-name:var(--font-geist-mono)]">
|
<ol className="list-inside list-decimal text-sm/6 text-center sm:text-left font-[family-name:var(--font-geist-mono)]">
|
||||||
<li className="mb-2 tracking-[-.01em]">
|
<li className="mb-2 tracking-[-.01em]">
|
||||||
Get started by editing{" "}
|
Get started by editing{" "}-From Feature Branch
|
||||||
<code className="bg-black/[.05] dark:bg-white/[.06] px-1 py-0.5 rounded font-[family-name:var(--font-geist-mono)] font-semibold">
|
<code className="bg-black/[.05] dark:bg-white/[.06] px-1 py-0.5 rounded font-[family-name:var(--font-geist-mono)] font-semibold">
|
||||||
app/page.tsx
|
app/page.tsx
|
||||||
</code>
|
</code>
|
||||||
|
|||||||
Reference in New Issue
Block a user