Build amarillo-base and derived images
Some checks failed
Amarillo/amarillo-gitea/amarillo-core/pipeline/head There was a failure building this commit
Some checks failed
Amarillo/amarillo-gitea/amarillo-core/pipeline/head There was a failure building this commit
This commit is contained in:
parent
213967511d
commit
3b6b8dddf8
|
|
@ -18,18 +18,13 @@ RUN \
|
||||||
ENV ADMIN_TOKEN=''
|
ENV ADMIN_TOKEN=''
|
||||||
ENV RIDE2GO_TOKEN=''
|
ENV RIDE2GO_TOKEN=''
|
||||||
ENV SECRET_KEY=''
|
ENV SECRET_KEY=''
|
||||||
ENV METRICS_USER=''
|
|
||||||
ENV METRICS_PASSWORD=''
|
ENV MODULE_NAME=amarillo.main
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
ARG PACKAGE_REGISTRY_URL
|
|
||||||
ARG PLUGINS
|
|
||||||
|
|
||||||
COPY requirements.txt /app/requirements.txt
|
COPY requirements.txt /app/requirements.txt
|
||||||
RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
|
RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
|
||||||
RUN --mount=type=secret,id=AMARILLO_REGISTRY_CREDENTIALS \
|
|
||||||
pip install --no-cache-dir --upgrade --extra-index-url https://$(cat /run/secrets/AMARILLO_REGISTRY_CREDENTIALS)@${PACKAGE_REGISTRY_URL} ${PLUGINS}
|
|
||||||
|
|
||||||
COPY ./amarillo /app/amarillo
|
COPY ./amarillo /app/amarillo
|
||||||
COPY ./amarillo/plugins /app/amarillo/plugins
|
COPY ./amarillo/plugins /app/amarillo/plugins
|
||||||
|
|
|
||||||
56
Jenkinsfile
vendored
56
Jenkinsfile
vendored
|
|
@ -1,16 +1,17 @@
|
||||||
pipeline {
|
pipeline {
|
||||||
agent any
|
agent { label 'builtin' }
|
||||||
environment {
|
environment {
|
||||||
GITEA_CREDS = credentials('AMARILLO-JENKINS-GITEA-USER')
|
GITEA_CREDS = credentials('AMARILLO-JENKINS-GITEA-USER')
|
||||||
TWINE_REPO_URL = "https://git.gerhardt.io/api/packages/amarillo/pypi"
|
TWINE_REPO_URL = "https://git.gerhardt.io/api/packages/amarillo/pypi"
|
||||||
PLUGINS_REPO_URL = "git.gerhardt.io/api/packages/amarillo/pypi/simple"
|
PLUGINS_REPO_URL = "git.gerhardt.io/api/packages/amarillo/pypi/simple"
|
||||||
DOCKER_REGISTRY_URL = 'https://git.gerhardt.io'
|
DOCKER_REGISTRY_URL = 'https://git.gerhardt.io'
|
||||||
|
DERIVED_DOCKERFILE = 'standard.Dockerfile'
|
||||||
OWNER = 'amarillo'
|
OWNER = 'amarillo'
|
||||||
|
BASE_IMAGE_NAME = 'amarillo-base'
|
||||||
IMAGE_NAME = 'amarillo'
|
IMAGE_NAME = 'amarillo'
|
||||||
AMARILLO_DISTRIBUTION = '0.1'
|
AMARILLO_DISTRIBUTION = '0.1'
|
||||||
TAG = "${AMARILLO_DISTRIBUTION}.${BUILD_NUMBER}"
|
TAG = "${AMARILLO_DISTRIBUTION}.${BUILD_NUMBER}${env.BRANCH_NAME == 'main' ? '' : '-dev'}"
|
||||||
PLUGINS = 'amarillo-metrics amarillo-enhancer amarillo-grfs-exporter'
|
DEPLOY_WEBHOOK_URL = "${env.BRANCH_NAME == 'main' ? 'http://amarillo.mfdz.de:8888/mitanand' : 'http://amarillo.mfdz.de:8888/dev'}"
|
||||||
DEPLOY_WEBHOOK_URL = 'http://amarillo.mfdz.de:8888/mitanand'
|
|
||||||
DEPLOY_SECRET = credentials('AMARILLO-JENKINS-DEPLOY-SECRET')
|
DEPLOY_SECRET = credentials('AMARILLO-JENKINS-DEPLOY-SECRET')
|
||||||
}
|
}
|
||||||
stages {
|
stages {
|
||||||
|
|
@ -41,22 +42,53 @@ pipeline {
|
||||||
sh 'python3 -m twine upload --skip-existing --verbose --repository-url $TWINE_REPO_URL --username $GITEA_CREDS_USR --password $GITEA_CREDS_PSW ./dist/*'
|
sh 'python3 -m twine upload --skip-existing --verbose --repository-url $TWINE_REPO_URL --username $GITEA_CREDS_USR --password $GITEA_CREDS_PSW ./dist/*'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Build docker image') {
|
stage('Build base docker image') {
|
||||||
when {
|
when {
|
||||||
branch 'main'
|
anyOf { branch 'main'; branch 'dev' }
|
||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
echo 'Building image'
|
echo 'Building image'
|
||||||
script {
|
script {
|
||||||
docker.build("${OWNER}/${IMAGE_NAME}:${TAG}",
|
docker.build("${OWNER}/${BASE_IMAGE_NAME}:${TAG}")
|
||||||
//--no-cache to make sure plugins are updated
|
// "--no-cache --build-arg='PACKAGE_REGISTRY_URL=${PLUGINS_REPO_URL}' --build-arg='PLUGINS=${PLUGINS}' --secret id=AMARILLO_REGISTRY_CREDENTIALS,env=GITEA_CREDS .")
|
||||||
"--no-cache --build-arg='PACKAGE_REGISTRY_URL=${PLUGINS_REPO_URL}' --build-arg='PLUGINS=${PLUGINS}' --secret id=AMARILLO_REGISTRY_CREDENTIALS,env=GITEA_CREDS .")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Push image to container registry') {
|
stage('Push base image to container registry') {
|
||||||
when {
|
when {
|
||||||
branch 'main'
|
anyOf { branch 'main'; branch 'dev' }
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
echo 'Pushing image to registry'
|
||||||
|
script {
|
||||||
|
docker.withRegistry(DOCKER_REGISTRY_URL, 'AMARILLO-JENKINS-GITEA-USER'){
|
||||||
|
def image = docker.image("${OWNER}/${BASE_IMAGE_NAME}:${TAG}")
|
||||||
|
image.push()
|
||||||
|
image.push('latest')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Build derived docker image') {
|
||||||
|
when {
|
||||||
|
anyOf { branch 'main'; branch 'dev' }
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
echo 'Building image'
|
||||||
|
script {
|
||||||
|
docker.withRegistry(DOCKER_REGISTRY_URL, 'AMARILLO-JENKINS-GITEA-USER'){
|
||||||
|
docker.build("${OWNER}/${IMAGE_NAME}:${TAG}",
|
||||||
|
//--no-cache to make sure plugins are updated
|
||||||
|
"-f ${DERIVED_DOCKERFILE} --no-cache --build-arg='PACKAGE_REGISTRY_URL=${PLUGINS_REPO_URL}' --secret id=AMARILLO_REGISTRY_CREDENTIALS,env=GITEA_CREDS .")
|
||||||
|
// "--no-cache --build-arg='PACKAGE_REGISTRY_URL=${PLUGINS_REPO_URL}' --build-arg='PLUGINS=${PLUGINS}' --secret id=AMARILLO_REGISTRY_CREDENTIALS,env=GITEA_CREDS .")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Push derived image to container registry') {
|
||||||
|
when {
|
||||||
|
anyOf { branch 'main'; branch 'dev' }
|
||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
echo 'Pushing image to registry'
|
echo 'Pushing image to registry'
|
||||||
|
|
@ -71,7 +103,7 @@ pipeline {
|
||||||
}
|
}
|
||||||
stage('Notify CD script') {
|
stage('Notify CD script') {
|
||||||
when {
|
when {
|
||||||
branch 'main'
|
anyOf { branch 'main'; branch 'dev' }
|
||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
echo 'Triggering deploy webhook'
|
echo 'Triggering deploy webhook'
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[project]
|
[project]
|
||||||
name = "amarillo"
|
name = "amarillo"
|
||||||
version = "0.0.15a4"
|
version = "0.0.16a1"
|
||||||
description = "Aggregates and enhances carpooling-offers and publishes them as GTFS(-RT)"
|
description = "Aggregates and enhances carpooling-offers and publishes them as GTFS(-RT)"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license = {file = "LICENSE"}
|
license = {file = "LICENSE"}
|
||||||
|
|
|
||||||
15
standard.Dockerfile
Normal file
15
standard.Dockerfile
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
FROM amarillo/amarillo-base
|
||||||
|
|
||||||
|
ARG PLUGINS=\
|
||||||
|
"amarillo-metrics "\
|
||||||
|
"amarillo-gtfs-exporter "
|
||||||
|
|
||||||
|
ARG PACKAGE_REGISTRY_URL
|
||||||
|
|
||||||
|
ENV METRICS_USER=''
|
||||||
|
ENV METRICS_PASSWORD=''
|
||||||
|
|
||||||
|
# RUN pip install $PLUGINS
|
||||||
|
|
||||||
|
RUN --mount=type=secret,id=AMARILLO_REGISTRY_CREDENTIALS \
|
||||||
|
pip install --no-cache-dir --upgrade --extra-index-url https://$(cat /run/secrets/AMARILLO_REGISTRY_CREDENTIALS)@${PACKAGE_REGISTRY_URL} ${PLUGINS}
|
||||||
Loading…
Reference in a new issue