diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7bed741 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,3 @@ +FROM httpd + +COPY ./public/ /usr/local/apache2/htdocs/ diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..ee57a60 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,45 @@ +node { + stage ("Checkout") { + checkout scm + } + + stage ("Dependencies") { + npm ci + } + + stage ("Build Gatsby") { + environment { + GATSBY_FIREBASE_API_KEY = credentials('FIREBASE_API_KEY') + GATSBY_AUTH_DOMAIN = spencassemble-sol-journal.firebaseapp.com + GATSBY_DATABASE_URL = https://spencassemble-sol-journal.firebaseio.com + GATSBY_PROJECT_ID = spencassemble-sol-journal + GATSBY_STORAGE_BUCKET = spencassemble-sol-journal.appspot.com + GATSBY_MESSAGING_SENDER_ID = 299522647169 + GATSBY_APP_ID = 1:299522647169:web:fc74af44747fd7cef79980 + } + steps { + npm run build + } + } + + docker.withServer("ssh://rancher@192.168.1.116") { + docker.image("docker").withRun("") { + withCredentials([usernamePassword(credentialsId: "DockerHub", usernameVariable: "DOCKERUSER", passwordVariable: "DOCKERPASS")]) { + sh 'docker login -u "$DOCKERUSER" -p "$DOCKERPASS"' + } + + stage ("Build Container") { + sh "docker image build -t spencerpincott/sol-journal:1.${env.BUILD_NUMBER} ." + } + + stage ("Publish Container") { + sh "docker image push spencerpincott/sol-journal:1.${env.BUILD_NUMBER}" + } + } + } + + stage ("Deploy") { + sh "ssh rancher@192.168.1.116 'docker stop sol-journal && docker rm sol-journal'" + sh "ssh rancher@192.168.1.116 'docker run -dit -p 5000:80 --name sol-journal --restart=always spencerpincott/sol-journal:1.${env.BUILD_NUMBER}'" + } +} diff --git a/public/index.html b/public/index.html index da1c581..811d816 100644 --- a/public/index.html +++ b/public/index.html @@ -1 +1 @@ -
Journaling can improve your health and help you take inventory of your day. Sol Journal works offline and from any device. Use it as a place to record thoughts and events from the day.
Lightweight with the functionalities you need for journaling, and none of the things you don't:
