Selaa lähdekoodia

Add Jenkinsfile

maxep 7 vuotta sitten
vanhempi
commit
ca913325ea
2 muutettua tiedostoa jossa 17 lisäystä ja 60 poistoa
  1. 0 60
      Dockerfile
  2. 17 0
      Jenkinsfile

+ 0 - 60
Dockerfile

@@ -3,65 +3,5 @@ MAINTAINER Maxime Epain "me@maxep.me"
 
 EXPOSE 80
 
-# Packages
-RUN apk --no-cache add \
-  ruby \
-  ruby-dev \
-  ruby-irb \
-  ruby-rdoc \
-  ruby-bigdecimal
-
-RUN apk --no-cache add \
-  zlib-dev \
-  build-base \
-  libxml2-dev \
-  libxslt-dev \
-  readline-dev \
-  libffi-dev \
-  yaml-dev \
-  zlib-dev \
-  libffi-dev \
-  cmake
-
-RUN apk --no-cache add \
-  linux-headers \
-  openjdk8-jre \
-  less \
-  zlib \
-  libxml2 \
-  readline \
-  libxslt \
-  libffi \
-  git \
-  nodejs \
-  tzdata \
-  shadow \
-  bash \
-  su-exec \
-  nodejs-npm \
-  libressl \
-  yarn
-
-# Install bundle of gems
-WORKDIR /tmp
-COPY Gemfile /tmp/
-COPY Gemfile.lock /tmp/
-RUN gem install bundler \
-  && bundle config --global silence_root_warning 1 \
-  && bundle install
-
-# --
-RUN addgroup -Sg 1000 jekyll
-RUN adduser  -Su 1000 -G \
-  jekyll jekyll
-
-# Add site
-COPY . /home/app/site
-RUN chown -R jekyll:jekyll /home/app/site
-
-# Build the site with Jekyll
-WORKDIR /home/app/site
-RUN jekyll build
-
 # Copy site
 COPY _site/ /usr/share/nginx/html

+ 17 - 0
Jenkinsfile

@@ -0,0 +1,17 @@
+node (label: 'docker') {
+	def app
+
+	stage('Build') {
+		checkout scm
+		sh 'docker run --rm --volume="$PWD:/srv/jekyll" jekyll/builder jekyll build'
+        app = docker.build("maxep/mikee")
+    }
+	
+	stage('Push Image') {
+        docker.withRegistry('https://registry.hub.docker.com', 'docker-hub-credentials') {
+            app.push("${env.BUILD_NUMBER}")
+            app.push("latest")
+        }
+		sh 'docker image prune -a -f'
+    }
+}