initial commit
nclazz/static-webserver-docker/pipeline/head There was a failure building this commit
Details
nclazz/static-webserver-docker/pipeline/head There was a failure building this commit
Details
commit
6c9388a58a
|
@ -0,0 +1 @@
|
|||
*.tmp
|
|
@ -0,0 +1,41 @@
|
|||
FROM alpine:3.15.0 AS builder
|
||||
|
||||
ARG THTTPD_VERSION=2.29
|
||||
|
||||
# Install all dependencies required for compiling thttpd
|
||||
RUN apk add gcc musl-dev make
|
||||
|
||||
# Download thttpd sources
|
||||
RUN wget http://www.acme.com/software/thttpd/thttpd-${THTTPD_VERSION}.tar.gz \
|
||||
&& tar xzf thttpd-${THTTPD_VERSION}.tar.gz \
|
||||
&& mv /thttpd-${THTTPD_VERSION} /thttpd
|
||||
|
||||
# Compile thttpd to a static binary which we can copy around
|
||||
RUN cd /thttpd \
|
||||
&& ./configure \
|
||||
&& make CCOPT='-O2 -s -static' thttpd
|
||||
|
||||
# Create a non-root user to own the files and run our server
|
||||
RUN adduser -D static
|
||||
|
||||
# Switch to the scratch image
|
||||
FROM scratch
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
# Copy over the user
|
||||
COPY --from=builder /etc/passwd /etc/passwd
|
||||
|
||||
# Copy the thttpd static binary
|
||||
COPY --from=builder /thttpd/thttpd /
|
||||
|
||||
# Use our non-root user
|
||||
USER static
|
||||
WORKDIR /home/static
|
||||
|
||||
# Copy the static website
|
||||
# Use the .dockerignore file to control what ends up inside the image!
|
||||
COPY . .
|
||||
|
||||
# Run thttpd
|
||||
CMD ["/thttpd", "-D", "-h", "0.0.0.0", "-p", "80", "-d", "/home/static", "-u", "static", "-l", "-", "-M", "60"]
|
|
@ -0,0 +1,85 @@
|
|||
pipeline {
|
||||
agent { label 'docker' }
|
||||
|
||||
environment {
|
||||
DOCKER_REGISTRY = "docker.nclazz.de"
|
||||
DOCKER_IMAGE_NAME = "nclazz/static-webserver:latest"
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Build Docker Image') {
|
||||
steps {
|
||||
script {
|
||||
docker.withRegistry("https://$DOCKER_REGISTRY", "jenkins_nexus") {
|
||||
sh 'docker build --tag $DOCKER_IMAGE_NAME'
|
||||
sh 'docker push $DOCKER_REGISTRY/$DOCKER_IMAGE_NAME'
|
||||
sh 'docker rmi $(docker images --filter "dangling=true" -q --no-trunc)'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
cleanWs()
|
||||
}
|
||||
failure {
|
||||
slackSend(
|
||||
channel: "notifications",
|
||||
color: "danger",
|
||||
message: "There is a *build failure* in ${env.JOB_NAME}.\nBuild: ${env.BUILD_URL} "
|
||||
)
|
||||
emailext(
|
||||
recipientProviders: [developers()],
|
||||
from: "jenkins@nclazz.de",
|
||||
subject: "Jenkins job ${env.JOB_NAME}#${env.BUILD_NUMBER} failed",
|
||||
body: """
|
||||
There is a build failure in ${env.JOB_NAME}.
|
||||
Build: ${env.BUILD_URL}
|
||||
Logs: ${env.BUILD_URL}console
|
||||
Changes: ${env.BUILD_URL}changes
|
||||
--
|
||||
"""
|
||||
)
|
||||
}
|
||||
unstable {
|
||||
slackSend(
|
||||
channel: "notifications",
|
||||
color: "warning",
|
||||
message: "Some tests have failed in ${env.JOB_NAME}.\nBuild: ${env.BUILD_URL} "
|
||||
)
|
||||
emailext(
|
||||
recipientProviders: [developers()],
|
||||
from: "jenkins@nclazz.de",
|
||||
subject: "Jenkins job ${env.JOB_NAME}#${env.BUILD_NUMBER} unstable",
|
||||
body: """
|
||||
Some tests have failed in ${env.JOB_NAME}.
|
||||
Build: ${env.BUILD_URL}
|
||||
Logs: ${env.BUILD_URL}console
|
||||
Changes: ${env.BUILD_URL}changes
|
||||
--
|
||||
"""
|
||||
)
|
||||
}
|
||||
fixed {
|
||||
slackSend(
|
||||
channel: "notifications",
|
||||
color: "good",
|
||||
message: "The build ${env.JOB_NAME} completed successfully and is back to normal.\nBuild: ${env.BUILD_URL} "
|
||||
)
|
||||
emailext(
|
||||
recipientProviders: [developers()],
|
||||
from: "jenkins@nclazz.de",
|
||||
subject: "Jenkins job ${env.JOB_NAME}#${env.BUILD_NUMBER} fixed",
|
||||
body: """
|
||||
The build ${env.JOB_NAME} completed successfully and is back to normal.
|
||||
|
||||
Build: ${env.BUILD_URL}
|
||||
Logs: ${env.BUILD_URL}console
|
||||
Changes: ${env.BUILD_URL}changes
|
||||
--
|
||||
"""
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
Static Webserver
|
||||
================================
|
||||
|
||||
Static Webserver is a simple docker (base) image for serving static content.
|
||||
Its based on [this](https://lipanski.com/posts/smallest-docker-image-static-website) blog article by Florin Lipan.
|
||||
|
||||
The resultung image is only `186 KB` + size of the static content.
|
||||
|
||||
Usage
|
||||
--------------------------------
|
||||
Use this image as base image and copy all static content to `/home/static/`.
|
Loading…
Reference in New Issue