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 committed Aug 22, 2020
2 parents 20f7c81 + 293005e commit b4e3f25
Show file tree
Hide file tree
Showing 12 changed files with 411 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-julia-plots

# 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-julia-plots/binder-julia-plots
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-julia-plots/binder-julia-plots
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 }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# User's Makefile(s)
*Makefiles
*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 @@
# Pull the image containing Julia
FROM paveloom/binder-julia:0.1.0 AS binder-julia

# Base image
FROM paveloom/binder-tex:0.1.0

# Meta information
LABEL maintainer="Pavel Sobolev (https://github.com/Paveloom)"
LABEL version="0.1.0"
LABEL description="If `paveloom/binder-julia` and `paveloom/binder-tex` had a baby."
LABEL github-repository="https://github.com/paveloom-d/binder-julia-plots"
LABEL docker-repository="https://hub.docker.com/r/paveloom/binder-julia-plots"

# Copy the scripts to the root
COPY scripts /scripts

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

# Add `/usr/other/$USER/julia/bin` to the `PATH`
ENV PATH=$PATH:/usr/other/$USER/julia/bin

# Copy the Julia binaries folder
COPY --from=binder-julia /usr/other/$USER/julia /usr/other/$USER/julia

# Copy the Julia environment
COPY --from=binder-julia $HOME/.julia $HOME/.julia

# Install Julia packages
RUN /scripts/user/julia/install-julia-packages.sh

# Remove scripts
RUN sudo rm -rf /scripts
59 changes: 59 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# 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-julia-plots/tree/master) branch.

### What is this?

This is a Docker image from
[the series of images](https://github.com/orgs/paveloom-d/projects/1) based on the
[`paveloom/binder-base`](https://github.com/paveloom-d/binder-base) image. This one combines
[`paveloom/binder-julia`](https://github.com/paveloom-d/binder-julia) and
[`paveloom/binder-tex`](https://github.com/paveloom-d/binder-tex), and adds a couple of
Julia packages. The task of this image is to allow TeX to be used when creating labels on
plots. See more details about the content of the image under the spoiler.

<details>
<summary>Content of the image</summary>
<ul>
<li>
Base image:
<a href="https://github.com/paveloom-d/binder-tex">paveloom/binder-tex</a>
(0.1.1)
</li>
<li>
Julia environment
from <a href=https://github.com/paveloom-d/binder-julia>paveloom/binder-julia</a>
(0.1.0)
<ul>
<li>Packages</li>
<ul>
<li><a href="https://github.com/JuliaLang/IJulia.jl">IJulia.jl</a></li>
<li><a href="https://github.com/JuliaPy/PyPlot.jl">PyPlot.jl</a></li>
<li><a href="https://github.com/JuliaPlots/Plots.jl">Plots.jl</a></li>
<ul>
</ul>
</li>
</ul>
</details>

### Any examples?

Yeah, there's a Jupyter notebook you can watch static
[here on GitHub](https://github.com/paveloom-d/binder-julia-plots/blob/master/examples/example.ipynb)
or interactively on
[Binder](https://mybinder.org/v2/gh/paveloom-d/binder-julia-plots/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-julia-plots).
To get it, in your `Dockerfile` just specify:

```dockerfile
FROM paveloom/binder-julia-plots:tag
```

where the `tag` is one of the following:

* [0.1.0](https://github.com/paveloom-d/binder-julia-plots/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-julia-plots:0.1.0

# Get the example notebook
RUN wget https://raw.githubusercontent.com/paveloom-d/binder-julia-plots/master/examples/example.ipynb >/dev/null 2>&1
130 changes: 130 additions & 0 deletions examples/example.ipynb

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions scripts/user/julia/install-julia-packages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

echo '\n\e[1;36mInstalling Julia packages:\e[0m'

echo '\e[1;36m> Rebuilding `IJulia`...\e[0m'
julia -e 'using Pkg; Pkg.build("IJulia")' >/dev/null 2>&1

echo '\e[1;36m> Installing `PyPlot`...\e[0m'
julia -e 'using Pkg; Pkg.add("PyPlot"); using PyPlot' >/dev/null 2>&1

echo '\e[1;36m> Installing `Plots`...\e[0m\n'
julia -e 'using Pkg; Pkg.add("Plots"); using Plots' >/dev/null 2>&1

0 comments on commit b4e3f25

Please sign in to comment.