Skip to content

Commit

Permalink
Dev (#68)
Browse files Browse the repository at this point in the history
* Baseimage (#67)

* baseimage build separated from regular build to save time

* buildx push

* fix build command

* remove dependencies and switcht o baseimage
  • Loading branch information
reinhard-brandstaedter authored Oct 7, 2023
1 parent 72a7e68 commit b56adde
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 9 deletions.
10 changes: 1 addition & 9 deletions src/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
FROM python:3.10-alpine
FROM rbrandstaedter/solarflow-control-baseimage:latest

# Create stdconfig directory
WORKDIR /

COPY solarflow-control.py /

# dependencies needed for ARMv6/7 builds
RUN pip install --upgrade pip && \
apk add libxml2-dev libxslt-dev libffi libffi-dev gcc musl-dev rust cargo openssl-dev && \
pip install paho-mqtt astral ip2geotools && \
apk del openssl-dev libffi-dev xz-dev libxml2-dev libxslt-dev openssl-dev linux-headers musl-dev gcc rust cargo && \
rm -rf /root/.cache/ && \
rm -rf /var/cache/apk/*

ENTRYPOINT ["python","solarflow-control.py"]
14 changes: 14 additions & 0 deletions src/Dockerfile-baseimage
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM python:3.10-alpine

# Create stdconfig directory
WORKDIR /

# dependencies needed for ARMv6/7 builds
RUN pip install --upgrade pip && \
apk add libxml2-dev libxslt-dev libffi libffi-dev gcc musl-dev rust cargo openssl-dev && \
pip install paho-mqtt astral ip2geotools && \
apk del openssl-dev libffi-dev xz-dev libxml2-dev libxslt-dev openssl-dev linux-headers musl-dev gcc rust cargo && \
rm -rf /root/.cache/ && \
rm -rf /var/cache/apk/*

ENTRYPOINT ["python"]
35 changes: 35 additions & 0 deletions src/Jenkinsfile-baseimage
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
pipeline {
agent { label 'docker-builder' }

environment {
DOCKER_HOST = "tcp://docker.local:2375"
DOCKER_REGISTRY = "rbrandstaedter"
LOG_LEVEL = "INFO"
BUILD_NUMBER = "${BUILD_NUMBER}"
TAG = "0.${BUILD_NUMBER}"
DOCKERHUB_LOGIN = credentials('docker-login-private')
GITHUB_AUTH_TOKEN = credentials('github_auth_token')
git_branch = "${GIT_BRANCH}"
BRANCH_NAME = git_branch.substring(git_branch.lastIndexOf('/') + 1, git_branch.length())
}

stages {
stage('Build Docker Base Images') {
steps {
sh 'printenv'
dir("${env.WORKSPACE}/src"){
sh label: 'Set up X-Builder', script: 'docker buildx rm crossbuilder && docker buildx create --name crossbuilder --platform linux/amd64,linux/arm/v6 && docker buildx ls && docker buildx use crossbuilder && docker buildx inspect --bootstrap'
sh label: 'Build Base Image', script: 'docker -H ${DOCKER_HOST} buildx build --push --platform linux/amd64,linux/arm/v6 -t ${DOCKER_REGISTRY}/solarflow-control-baseimage:latest -f Dockerfile-baseimage .'
}
}
}
}
post {
always {
cleanWs(cleanWhenNotBuilt: false,
deleteDirs: true,
disableDeferredWipeout: true,
notFailBuild: true)
}
}
}

0 comments on commit b56adde

Please sign in to comment.