Skip to content
This repository has been archived by the owner on Apr 1, 2022. It is now read-only.

Commit

Permalink
(#2) v0.1.0:
Browse files Browse the repository at this point in the history
* (#1) Sketch a basic version.
  • Loading branch information
Pavel Sobolev authored Aug 19, 2020
2 parents dfaa3fe + 63d6da9 commit 469b681
Show file tree
Hide file tree
Showing 14 changed files with 463 additions and 1 deletion.
17 changes: 17 additions & 0 deletions .github/config/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
template: |
## Diff
$CHANGES
version-resolver:
major:
labels:
- 'major'
minor:
labels:
- 'minor'
patch:
labels:
- 'patch'
default: patch
28 changes: 28 additions & 0 deletions .github/scripts/build.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

# A script to build the image and test a container based on it

# Download dive
echo -e '\n\e[1;36mDownloading dive...\e[0m\n'
wget https://github.com/wagoodman/dive/releases/download/v0.9.2/dive_0.9.2_linux_amd64.deb

# Install dive
echo -e '\e[1;36mInstalling dive...\e[0m\n'
sudo apt install ./dive_0.9.2_linux_amd64.deb

# Activate experimental features
echo -e '\n\e[1;36mActivating experimental features...\e[0m\n'
sudo tee /etc/docker/daemon.json > /dev/null << EOF
{
"experimental": true
}
EOF
sudo service docker restart

# Build the image
echo -e '\e[1;36mBuilding the image...\e[0m\n'
docker build -t image --squash .

# Analyse the image
echo -e '\n\e[1;36mAnalyzing the image...\e[0m\n'
CI=true dive image
51 changes: 51 additions & 0 deletions .github/scripts/publish-docker.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash

# A script to decide what version to upload

# Set current repository variable
REPOSITORY=paveloom-d/binder-tex

# Get last published version
LAST_VERSION=$(curl --silent "https://api.github.com/repos/$REPOSITORY/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')

# Check if there is some tag
if [ ! -z "$LAST_VERSION" ]; then

# Get current tag
CURRENT_TAG=$(echo ${GITHUB_REF#refs/*/})

# Print info
echo -e "\n\e[1;36mLast version: $LAST_VERSION\e[0m"
echo -e "\e[1;36mCurrent tag: $CURRENT_TAG\e[0m\n"

# Check if the tag is a semantic version
if echo "$CURRENT_TAG" | grep -E "^v[0-9]+\.[0-9]+\.[0-9]+$"; then

# Print information
echo -e "\e[1;36mCurrent tag is a semantic version. Tagged image will be published.\e[0m\n"

# Set environment variable
echo ::set-env name=RELEASE_VERSION::$(echo ${CURRENT_TAG} | sed 's/v//')

# Publish tagged image
echo ::set-env name=PUBLISH_RELEASE_VERSION::$(echo true)

else

# Print information
echo -e "\e[1;36mCurrent tag is not a semantic version. Tagged image will not be published.\e[0m\n"

# Don't publish tagged image
echo ::set-env name=PUBLISH_RELEASE_VERSION::$(echo false)

fi

else

# Print information
echo -e "\n\e[1;36mNo release has been found, tagged version will not be published.\e[0m\n"

# Don't publish tagged image
echo ::set-env name=PUBLISH_RELEASE_VERSION::$(echo false)

fi
36 changes: 36 additions & 0 deletions .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Publish Docker

on:
release:
types: [published]
push:
branches:
- develop

jobs:
Update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Get release version
run: bash .github/scripts/publish-docker.bash

- name: Publish to Registry (with a tagged image)
if: ${{ env.PUBLISH_RELEASE_VERSION == 'true' }}
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: paveloom-d/binder-tex/binder-tex
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
tags: "latest,${{ env.RELEASE_VERSION }}"

- name: Publish to Registry (without a tagged image)
if: ${{ env.PUBLISH_RELEASE_VERSION == 'false' }}
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: paveloom-d/binder-tex/binder-tex
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
tags: "latest"
16 changes: 16 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Release Drafter

on:
push:
branches:
- develop

jobs:
Update:
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5
with:
config-name: config/release-drafter.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# User's Makefile(s)
Makefile
*Makefile

# Jupyter's checkpoint files
*ipynb_checkpoints
23 changes: 23 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
language: shell
dist: bionic

os:
- linux

branches:
except:
- master
- develop
- /^v\d+\.\d+(\.\d+)?(-\S*)?$/

services:
- docker

jobs:
include:
- stage: "Build"
name: "Build Docker Image"
script: bash .github/scripts/build.bash

notifications:
email: false
33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Base image
FROM paveloom/binder-base:0.1.1

# Meta information
LABEL maintainer="Pavel Sobolev (https://github.com/Paveloom)"
LABEL version="0.1.0"
LABEL description="Basically, `paveloom/binder-base` + TeX dependencies."
LABEL github-repository="https://github.com/paveloom-d/binder-tex"
LABEL docker-repository="https://hub.docker.com/r/paveloom/binder-tex"

# Switch to the `root` user
USER root

# Copy the scripts to the root
COPY scripts /scripts

# Allow their execution
RUN chmod -R +x /scripts

# Temporarily disable prompts during the build
ARG DEBIAN_FRONTEND=noninteractive

# Install TeX dependencies
RUN /scripts/root/texlive/install-texlive.sh

# Switch back to the non-root user
USER $USER

# Install Python packages
RUN /scripts/user/python/install-python-packages.sh

# Remove scripts
RUN sudo rm -rf /scripts
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Pavel Sobolev

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
56 changes: 56 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Description

### A notice
If you are unsure, please refer to the description on the last commit on the
[`master`](https://github.com/paveloom-d/binder-tex/tree/master) branch.

### What is this?

This is a Docker image from a series of images based on the
[`paveloom/binder-base`](https://github.com/paveloom-d/binder-base) image. It adds some
TeX dependencies and a couple of Python packages. See more under the spoiler:

<details>
<summary>Content of the image</summary>
<ul>
<li>
Base image:
<a href="https://github.com/paveloom-d/binder-base">paveloom/binder-base</a>
(0.1.1)
</li>
<li>TexLive:</li>
<ul>
<li>dvipng</li>
<li>texlive-latex-extra</li>
<li>texlive-fonts-extra</li>
<li>texlive-lang-cyrillic</li>
<li>cm-super</li>
</ul>
<li>Python packages:</li>
<ul>
<li>wheel</li>
<li>numpy</li>
<li>matplotlib</li>
</ul>
</ul>
</details>

### Any examples?

Yeah, there's a Jupyter notebook you can watch static
[here on GitHub](https://github.com/paveloom-d/binder-tex/blob/master/examples/example.ipynb)
or interactively on
[Binder](https://mybinder.org/v2/gh/paveloom-d/binder-tex/master?urlpath=lab/tree/example.ipynb).

### How do I use it?

The image is hosted on [Docker Hub](https://hub.docker.com/r/paveloom/binder-tex).
To get it, in your `Dockerfile` just specify:

```dockerfile
FROM paveloom/binder-tex:tag
```

where the `tag` is one of the following:

* [0.1.0](https://github.com/paveloom-d/binder-tex/releases/tag/v0.1.0)
5 changes: 5 additions & 0 deletions binder/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Base image
FROM paveloom/binder-tex:0.1.0

# Get the example notebook
RUN wget https://raw.githubusercontent.com/paveloom-d/binder-tex/master/examples/example.ipynb
Loading

0 comments on commit 469b681

Please sign in to comment.