Skip to content
This repository has been archived by the owner on May 15, 2021. It is now read-only.

Commit

Permalink
Merge pull request #27 from HackerHappyHour/publish-docker
Browse files Browse the repository at this point in the history
Publish docker
  • Loading branch information
LongLiveCHIEF authored Apr 19, 2019
2 parents 0561441 + 483a2c5 commit bc5b74a
Show file tree
Hide file tree
Showing 9 changed files with 145 additions and 9 deletions.
53 changes: 52 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,56 @@ jobs:
- dependency-cache-{{ checksum "package.json" }}
- dependency-cache-
- run: npm install
- run: npx semantic-release --branch $CIRCLE_BRANCH --dry-run=<< parameters.dry-run >>
- run: |
echo -e "NEW_RELEASE=false" > RELEASE.env # will be overriden if release detected
npx semantic-release --branch $CIRCLE_BRANCH --dry-run=<< parameters.dry-run >>
cat RELEASE.env
# - run: echo -e "NEW_RELEASE=true\nVERSION=1.0.1" > RELEASE.env # force publish docker images at hard-coded version
- persist_to_workspace:
root: ~/project
paths:
- RELEASE.env
- save_cache:
key: dependency-cache-{{ checksum "package.json" }}
paths:
- node_modules

publish-docker:
docker:
- image: circleci/buildpack-deps:stretch
environment:
IMAGE_NAME: hackerhappyhour/reveal
steps:
- checkout
- setup_remote_docker
- attach_workspace:
at: ~/project
- run:
name: Build and publish
command: |
cat RELEASE.env
source RELEASE.env # loads VERSION and NEW_RELEASE env vars in to environment
if [ "$NEW_RELEASE" = true ]; then
echo "Building images..."
make build
make build-dev
make build-markdown
echo "Tagging images with version: ${VERSION}..."
docker tag ${IMAGE_NAME}:latest ${IMAGE_NAME}:${VERSION}
docker tag ${IMAGE_NAME}:dev ${IMAGE_NAME}:dev-${VERSION}
docker tag ${IMAGE_NAME}:markdown ${IMAGE_NAME}:markdown-${VERSION}
echo "Publishing images..."
echo "${DOCKERHUB_PASS}" | docker login -u "$DOCKERHUB_USER" --password-stdin
docker push ${IMAGE_NAME}:dev-${VERSION}
docker push ${IMAGE_NAME}:dev
docker push ${IMAGE_NAME}:markdown-${VERSION}
docker push ${IMAGE_NAME}:markdown
docker push ${IMAGE_NAME}:${VERSION}
docker push ${IMAGE_NAME}:latest
else
echo "No new release detected, skipping Docker Hub publish..."
fi
workflows:
version: 2
build-and-release:
Expand All @@ -64,3 +108,10 @@ workflows:
branches:
only:
- master
- publish-docker:
requires:
- release
filters:
branches:
only:
- master
13 changes: 9 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
.PHONY: build markdown
IMAGE_NAME=hackerhappyhour/reveal

.PHONY: build build-dev build-markdown

build:
docker build -f docker/Dockerfile -t hackerhappyhour/reveal:latest ./docker
docker build -f docker/Dockerfile -t ${IMAGE_NAME}:latest ./docker

build-dev:
docker build -f docker/dev/Dockerfile -t ${IMAGE_NAME}:dev ./docker

markdown:
docker build -f docker/markdown/Dockerfile -t hackerhappyhour/reveal:markdown ./docker
build-markdown:
docker build -f docker/markdown/Dockerfile -t ${IMAGE_NAME}:markdown ./docker
4 changes: 3 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ FROM node:10 AS builder

WORKDIR /reveal

RUN npm install reveal.js
RUN npm install @h3/reveal

FROM nginx:1.15

LABEL source="https://github.com/HackerHappyHour/reveal"

ENV SITE=/usr/share/nginx/html

COPY nginx.conf /etc/nginx/
Expand Down
16 changes: 16 additions & 0 deletions docker/dev/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM node:10

LABEL source="https://github.com/HackerHappyHour/reveal"

RUN cd /tmp \
&& npm install @h3/reveal \
&& mv node_modules/@h3/reveal / \
&& cd /reveal \
&& npm install \
&& npm cache clean --force

WORKDIR /reveal

EXPOSE 8000 35729

CMD ["npm", "start"]
12 changes: 12 additions & 0 deletions docker/dev/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Example docker-compose.yml file implementation
version: '3'
services:
reveal:
image: hackerhappyhour/reveal:dev
ports:
- "8000:8000"
- "35729:35729" # live-reload server
volumes:
- ./index.html:/reveal/index.html
# - ./css/main.css:/reveal/css/main.css
# - ./images:/reveal/images
49 changes: 49 additions & 0 deletions docker/dev/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

<title>reveal.js</title>

<link rel="stylesheet" href="css/reveal.css">
<link rel="stylesheet" href="css/theme/black.css">

<!-- Theme used for syntax highlighting of code -->
<link rel="stylesheet" href="lib/css/zenburn.css">

<!-- Printing and PDF exports -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? 'css/print/pdf.css' : 'css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
</head>
<body>
<div class="reveal">
<div class="slides">
<section>Slide 1</section>
<section>Slide 2</section>
</div>
</div>

<script src="lib/js/head.min.js"></script>
<script src="js/reveal.js"></script>

<script>
// More info about config & dependencies:
// - https://github.com/hakimel/reveal.js#configuration
// - https://github.com/hakimel/reveal.js#dependencies
Reveal.initialize({
dependencies: [
{ src: 'plugin/markdown/marked.js' },
{ src: 'plugin/markdown/markdown.js' },
{ src: 'plugin/notes/notes.js', async: true },
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }
]
});
</script>
</body>
</html>
4 changes: 2 additions & 2 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3"
services:
revealjs:
image: reveal.js
reveal:
image: reveal
build: .
ports:
- "8080:8080"
1 change: 1 addition & 0 deletions gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module.exports = grunt => {
args: [
'--no-snadbox',
'--disable-setuid-sandbox',
'--disable-dev-shm-usage'
]
}
};
Expand Down
2 changes: 1 addition & 1 deletion release.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = {
'@semantic-release/git',
'@semantic-release/github',
['@semantic-release/exec', {
verifyReleaseCmd: 'echo "VERSION=${nextRelease.version}" > RELEASE.env'
verifyReleaseCmd: 'echo "VERSION=${nextRelease.version}\nNEW_RELEASE=true" > RELEASE.env'
}],
],
debug: true,
Expand Down

0 comments on commit bc5b74a

Please sign in to comment.