Docker support within the repository (#1732)
- Adds a Dockerfile within this repository - GitHub actions to build and test the image
This commit is contained in:
@@ -0,0 +1,39 @@
|
|||||||
|
name: Deploy docker
|
||||||
|
on: [push]
|
||||||
|
env:
|
||||||
|
DEPLOY_NAME: gollumwiki/gollum:latest
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: ${{ github.ref == 'refs/heads/master' }}
|
||||||
|
steps:
|
||||||
|
- name: Check Out Repo
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Login
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
id: buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
- name: Cache docker layers
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: /tmp/.buildx-cache
|
||||||
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-buildx-
|
||||||
|
- name: Build and push
|
||||||
|
id: docker_build
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: ./
|
||||||
|
file: ./Dockerfile
|
||||||
|
builder: ${{ steps.buildx.outputs.name }}
|
||||||
|
push: true
|
||||||
|
tags: ${{ env.DEPLOY_NAME }}
|
||||||
|
cache-from: type=local,src=/tmp/.buildx-cache
|
||||||
|
cache-to: type=local,dest=/tmp/.buildx-cache
|
||||||
|
- name: Image digest
|
||||||
|
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
name: Build and Test Docker
|
||||||
|
on: [push, pull_request]
|
||||||
|
env:
|
||||||
|
CI_IMAGE: gollum-ci-img
|
||||||
|
jobs:
|
||||||
|
build-and-test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check Out Repo
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
id: buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
- name: Cache docker layers
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: /tmp/.buildx-cache
|
||||||
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-buildx-
|
||||||
|
- name: Build
|
||||||
|
id: docker_build
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: ./
|
||||||
|
file: ./Dockerfile
|
||||||
|
builder: ${{ steps.buildx.outputs.name }}
|
||||||
|
push: false
|
||||||
|
tags: ${{ env.CI_IMAGE }}
|
||||||
|
outputs: type=docker
|
||||||
|
cache-from: type=local,src=/tmp/.buildx-cache
|
||||||
|
cache-to: type=local,dest=/tmp/.buildx-cache
|
||||||
|
- name: Image digest
|
||||||
|
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||||
|
- name: docker state
|
||||||
|
run: docker image ls
|
||||||
|
- name: Run tests
|
||||||
|
run: docker run -e CI=true -w /app --entrypoint bundle ${{ env.CI_IMAGE }} exec rake
|
||||||
+29
@@ -0,0 +1,29 @@
|
|||||||
|
FROM ruby:2.7
|
||||||
|
ENV DEBIAN_FRONTEND="noninteractive"
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
libicu-dev \
|
||||||
|
cmake
|
||||||
|
|
||||||
|
COPY Gemfile* /tmp/
|
||||||
|
COPY gollum.gemspec* /tmp/
|
||||||
|
WORKDIR /tmp
|
||||||
|
RUN bundle install
|
||||||
|
|
||||||
|
RUN gem install \
|
||||||
|
asciidoctor \
|
||||||
|
creole \
|
||||||
|
wikicloth \
|
||||||
|
org-ruby \
|
||||||
|
RedCloth \
|
||||||
|
bibtex-ruby \
|
||||||
|
&& echo "gem-extra complete"
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
COPY . /app
|
||||||
|
RUN bundle exec rake install
|
||||||
|
|
||||||
|
VOLUME /wiki
|
||||||
|
WORKDIR /wiki
|
||||||
|
COPY docker-run.sh /docker-run.sh
|
||||||
|
ENTRYPOINT ["/docker-run.sh"]
|
||||||
Executable
+9
@@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Initialize the wiki
|
||||||
|
if [ ! -d .git ]; then
|
||||||
|
git init
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Start gollum service
|
||||||
|
gollum --mathjax
|
||||||
Reference in New Issue
Block a user