├── .gitignore ├── Dockerfile ├── LICENSE ├── README.md ├── build_slidev ├── entrypoint.sh └── pyautobuild_slidev ├── Pipfile ├── Pipfile.lock └── main.py /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:16-alpine3.11 2 | 3 | LABEL maintainer="https://github.com/stig124" 4 | LABEL upstream="https://github.com/slidevjs/slidev" 5 | LABEL source="https://github.com/slidevjs/container" 6 | 7 | WORKDIR /root 8 | 9 | # Get the entrypoint script from the current directory 10 | COPY --chown=root:root entrypoint.sh /root 11 | 12 | #Make the entrypoint script executable and install npm 13 | RUN chmod 700 entrypoint.sh && npm install @slidev/cli @slidev/theme-default 14 | 15 | WORKDIR /root/slides 16 | 17 | ENTRYPOINT [ "/root/entrypoint.sh" ] -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Nicolas "stig124" FORMICHELLA 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Slidev Container 2 | ![ver](https://shields.io/docker/v/stig124/slidev?arch=amd64&sort=semver) ![imgs](https://shields.io/docker/pulls/stig124/slidev) 3 | ## Table of Contents 4 | 5 | - [About](#about) 6 | - [Getting Started](#getting_started) 7 | - [Usage](#usage) 8 | - [Contributing](../CONTRIBUTING.md) 9 | 10 | ## About 11 | 12 | This is the repository for the source of the Docker image for [slidev](https://github.com/slidevjs/slidev) hosted in the [Docker Hub](https://hub.docker.com/r/stig124/slidev) 13 | 14 | ##### *This is not meant to be a developing environment, it uses only npm-fetched distributions* 15 | 16 | 17 | ## Getting Started 18 | 19 | ### Prerequisites 20 | 21 | Just have `docker` (or `podman`) installed 22 | 23 | ### Usage 24 | 25 | Pull the image : 26 | 27 | ```bash 28 | $ docker pull stig124/slidev:latest 29 | 30 | or 31 | 32 | $ podman pull docker.io/stig124/slidev:latest 33 | ``` 34 | 35 | Go into a directory with a `slides.md` file and run it : 36 | 37 | ```bash 38 | $ docker run --rm -v "$PWD":/root/slides -p 3030:3030 stig124/slidev:latest 39 | ``` 40 | 41 | **WARNING** : Please note that if you have a `node_modules` folder within the folder with the `slides.md` file, It will be **deleted** (You can add `-e KEEP=1` next to `--rm` in the command to revert this behaviour) as it may blocks the starting of the container 42 | 43 | 44 | You can : 45 | 46 | - Run it in the backgroud by adding `-d` 47 | - Change the default port by replacing the left part of the port declaration 48 | 49 | ### Build 50 | 51 | You can also build the image yourself or tinker with it: 52 | 53 | ```bash 54 | $ git clone https://github.com/slidevjs/container.git 55 | $ cd container 56 | $ docker build -t . 57 | ``` 58 | 59 | > The tag syntax is as follows `username`/`image_name`:`version` 60 | > *`username` is mandatory only if you want to push to remote registry* 61 | 62 | ### LICENSE 63 | 64 | This repository is licensed under the MIT license 65 | -------------------------------------------------------------------------------- /build_slidev: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -eux 4 | 5 | key="$1" 6 | 7 | podman login docker.io --username stig124 --password "$(secrets.sh get docker)" 8 | 9 | tag="stig124/slidev:" 10 | tag+="$key" 11 | 12 | pushd /home/stig124/docker/dockerbuild/slidev/slidevc || exit 13 | 14 | podman build --no-cache -t "$tag" . 15 | docker_tag1="docker.io/" 16 | docker_tag1+="$tag" 17 | docker_tag2="docker.io/stig124/slidev:latest" 18 | podman tag "$tag" "$docker_tag1" 19 | podman tag "$tag" "$docker_tag2" 20 | podman push "$docker_tag1" 21 | podman push "$docker_tag2" 22 | 23 | 24 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ -z "${KEEP}" ]; then 4 | rm -rf /root/slides/node_modules 5 | else 6 | echo "WARNING : The app may not start" 7 | echo "If it doesn't start or/and prints an error message, delete or move the node_modules folder" 8 | fi 9 | if [ -f /root/slides/slides.md ]; then 10 | npx slidev --remote 11 | else 12 | echo "slides.md not found in the bind mount to /root/slides" 13 | echo "Please check the presence of that file" 14 | echo "Exiting" 15 | exit 1 16 | fi 17 | -------------------------------------------------------------------------------- /pyautobuild_slidev/Pipfile: -------------------------------------------------------------------------------- 1 | [[source]] 2 | url = "https://pypi.org/simple" 3 | verify_ssl = true 4 | name = "pypi" 5 | 6 | [packages] 7 | requests = "*" 8 | 9 | [dev-packages] 10 | ipython = "*" 11 | 12 | [requires] 13 | python_version = "3" 14 | -------------------------------------------------------------------------------- /pyautobuild_slidev/Pipfile.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_meta": { 3 | "hash": { 4 | "sha256": "a068cb2fdfb9bbec0d7c270aa863b75c3ef3f5b966ee0819f27d6437a504b733" 5 | }, 6 | "pipfile-spec": 6, 7 | "requires": { 8 | "python_version": "3" 9 | }, 10 | "sources": [ 11 | { 12 | "name": "pypi", 13 | "url": "https://pypi.org/simple", 14 | "verify_ssl": true 15 | } 16 | ] 17 | }, 18 | "default": { 19 | "certifi": { 20 | "hashes": [ 21 | "sha256:1a4995114262bffbc2413b159f2a1a480c969de6e6eb13ee966d470af86af59c", 22 | "sha256:719a74fb9e33b9bd44cc7f3a8d94bc35e4049deebe19ba7d8e108280cfd59830" 23 | ], 24 | "version": "==2020.12.5" 25 | }, 26 | "chardet": { 27 | "hashes": [ 28 | "sha256:0d6f53a15db4120f2b08c94f11e7d93d2c911ee118b6b30a04ec3ee8310179fa", 29 | "sha256:f864054d66fd9118f2e67044ac8981a54775ec5b67aed0441892edb553d21da5" 30 | ], 31 | "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'", 32 | "version": "==4.0.0" 33 | }, 34 | "idna": { 35 | "hashes": [ 36 | "sha256:b307872f855b18632ce0c21c5e45be78c0ea7ae4c15c828c20788b26921eb3f6", 37 | "sha256:b97d804b1e9b523befed77c48dacec60e6dcb0b5391d57af6a65a312a90648c0" 38 | ], 39 | "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", 40 | "version": "==2.10" 41 | }, 42 | "requests": { 43 | "hashes": [ 44 | "sha256:27973dd4a904a4f13b263a19c866c13b92a39ed1c964655f025f3f8d3d75b804", 45 | "sha256:c210084e36a42ae6b9219e00e48287def368a26d03a048ddad7bfee44f75871e" 46 | ], 47 | "index": "pypi", 48 | "version": "==2.25.1" 49 | }, 50 | "urllib3": { 51 | "hashes": [ 52 | "sha256:2f4da4594db7e1e110a944bb1b551fdf4e6c136ad42e4234131391e21eb5b0df", 53 | "sha256:e7b021f7241115872f92f43c6508082facffbd1c048e3c6e2bb9c2a157e28937" 54 | ], 55 | "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'", 56 | "version": "==1.26.4" 57 | } 58 | }, 59 | "develop": { 60 | "backcall": { 61 | "hashes": [ 62 | "sha256:5cbdbf27be5e7cfadb448baf0aa95508f91f2bbc6c6437cd9cd06e2a4c215e1e", 63 | "sha256:fbbce6a29f263178a1f7915c1940bde0ec2b2a967566fe1c65c1dfb7422bd255" 64 | ], 65 | "version": "==0.2.0" 66 | }, 67 | "decorator": { 68 | "hashes": [ 69 | "sha256:6f201a6c4dac3d187352661f508b9364ec8091217442c9478f1f83c003a0f060", 70 | "sha256:945d84890bb20cc4a2f4a31fc4311c0c473af65ea318617f13a7257c9a58bc98" 71 | ], 72 | "markers": "python_version >= '3.5'", 73 | "version": "==5.0.7" 74 | }, 75 | "ipython": { 76 | "hashes": [ 77 | "sha256:714810a5c74f512b69d5f3b944c86e592cee0a5fb9c728e582f074610f6cf038", 78 | "sha256:f78c6a3972dde1cc9e4041cbf4de583546314ba52d3c97208e5b6b2221a9cb7d" 79 | ], 80 | "index": "pypi", 81 | "version": "==7.23.1" 82 | }, 83 | "ipython-genutils": { 84 | "hashes": [ 85 | "sha256:72dd37233799e619666c9f639a9da83c34013a73e8bbc79a7a6348d93c61fab8", 86 | "sha256:eb2e116e75ecef9d4d228fdc66af54269afa26ab4463042e33785b887c628ba8" 87 | ], 88 | "version": "==0.2.0" 89 | }, 90 | "jedi": { 91 | "hashes": [ 92 | "sha256:18456d83f65f400ab0c2d3319e48520420ef43b23a086fdc05dff34132f0fb93", 93 | "sha256:92550a404bad8afed881a137ec9a461fed49eca661414be45059329614ed0707" 94 | ], 95 | "markers": "python_version >= '3.6'", 96 | "version": "==0.18.0" 97 | }, 98 | "matplotlib-inline": { 99 | "hashes": [ 100 | "sha256:5cf1176f554abb4fa98cb362aa2b55c500147e4bdbb07e3fda359143e1da0811", 101 | "sha256:f41d5ff73c9f5385775d5c0bc13b424535c8402fe70ea8210f93e11f3683993e" 102 | ], 103 | "markers": "python_version >= '3.5'", 104 | "version": "==0.1.2" 105 | }, 106 | "parso": { 107 | "hashes": [ 108 | "sha256:12b83492c6239ce32ff5eed6d3639d6a536170723c6f3f1506869f1ace413398", 109 | "sha256:a8c4922db71e4fdb90e0d0bc6e50f9b273d3397925e5e60a717e719201778d22" 110 | ], 111 | "markers": "python_version >= '3.6'", 112 | "version": "==0.8.2" 113 | }, 114 | "pexpect": { 115 | "hashes": [ 116 | "sha256:0b48a55dcb3c05f3329815901ea4fc1537514d6ba867a152b581d69ae3710937", 117 | "sha256:fc65a43959d153d0114afe13997d439c22823a27cefceb5ff35c2178c6784c0c" 118 | ], 119 | "markers": "sys_platform != 'win32'", 120 | "version": "==4.8.0" 121 | }, 122 | "pickleshare": { 123 | "hashes": [ 124 | "sha256:87683d47965c1da65cdacaf31c8441d12b8044cdec9aca500cd78fc2c683afca", 125 | "sha256:9649af414d74d4df115d5d718f82acb59c9d418196b7b4290ed47a12ce62df56" 126 | ], 127 | "version": "==0.7.5" 128 | }, 129 | "prompt-toolkit": { 130 | "hashes": [ 131 | "sha256:bf00f22079f5fadc949f42ae8ff7f05702826a97059ffcc6281036ad40ac6f04", 132 | "sha256:e1b4f11b9336a28fa11810bc623c357420f69dfdb6d2dac41ca2c21a55c033bc" 133 | ], 134 | "markers": "python_full_version >= '3.6.1'", 135 | "version": "==3.0.18" 136 | }, 137 | "ptyprocess": { 138 | "hashes": [ 139 | "sha256:4b41f3967fce3af57cc7e94b888626c18bf37a083e3651ca8feeb66d492fef35", 140 | "sha256:5c5d0a3b48ceee0b48485e0c26037c0acd7d29765ca3fbb5cb3831d347423220" 141 | ], 142 | "version": "==0.7.0" 143 | }, 144 | "pygments": { 145 | "hashes": [ 146 | "sha256:a18f47b506a429f6f4b9df81bb02beab9ca21d0a5fee38ed15aef65f0545519f", 147 | "sha256:d66e804411278594d764fc69ec36ec13d9ae9147193a1740cd34d272ca383b8e" 148 | ], 149 | "markers": "python_version >= '3.5'", 150 | "version": "==2.9.0" 151 | }, 152 | "traitlets": { 153 | "hashes": [ 154 | "sha256:178f4ce988f69189f7e523337a3e11d91c786ded9360174a3d9ca83e79bc5396", 155 | "sha256:69ff3f9d5351f31a7ad80443c2674b7099df13cc41fc5fa6e2f6d3b0330b0426" 156 | ], 157 | "markers": "python_version >= '3.7'", 158 | "version": "==5.0.5" 159 | }, 160 | "wcwidth": { 161 | "hashes": [ 162 | "sha256:beb4802a9cebb9144e99086eff703a642a13d6a0052920003a230f3294bbe784", 163 | "sha256:c4d647b99872929fdb7bdcaa4fbe7f01413ed3d98077df798530e5b04f116c83" 164 | ], 165 | "version": "==0.2.5" 166 | } 167 | } 168 | } 169 | -------------------------------------------------------------------------------- /pyautobuild_slidev/main.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import requests as curl 4 | import subprocess 5 | 6 | 7 | def getreleasegh(): 8 | owner = 'slidevjs/' 9 | repo = 'slidev/' 10 | search = 'tags' 11 | url = "https://api.github.com/repos/" + owner + repo + search 12 | with curl.get(url) as r: 13 | if r.status_code == 200: 14 | j = r.json() 15 | release = str(j[0]['name']) 16 | release = release.replace("v", "").replace(".", "").lstrip('0') 17 | return release 18 | 19 | 20 | def getactualimage(): 21 | owner = 'stig124/' 22 | repo = 'slidev/' 23 | search = 'tags' 24 | url = 'https://registry.hub.docker.com/v2/repositories/' + owner + repo + search 25 | with curl.get(url) as r: 26 | if r.status_code == 200: 27 | j = r.json() 28 | for i in range(10): 29 | image = str(j['results'][i]['name']) 30 | if image != 'latest' and '-buster' not in image: 31 | image = image.replace(".", "").lstrip('0') 32 | return image 33 | 34 | 35 | def checknpm(): 36 | base = 'https://api.npms.io/v2/search?q=' 37 | package = 'slidev' 38 | url = base + package 39 | with curl.get(url) as r: 40 | if r.status_code == 200: 41 | j = r.json() 42 | for i in range(5): 43 | if package in str(j['results'][i]['package']['scope']): 44 | npm = str(j['results'][i]['package']['version']) 45 | npm2 = npm.replace(".", "").lstrip('0') 46 | return npm2, npm 47 | 48 | 49 | def process(imv, ghv, npv, rv): 50 | if imv == ghv: 51 | print("Nothing to do") 52 | exit(0) 53 | elif imv < ghv: 54 | if ghv == npv: 55 | print("Build") 56 | cmd = "build_slidev " + rv 57 | try: 58 | subprocess.check_call(cmd, shell=True) 59 | except subprocess.CalledProcessError: 60 | print("Script failure") 61 | exit(4) 62 | else: 63 | print("Wating for NPM to catch up") 64 | exit(6) 65 | 66 | 67 | if __name__ == "__main__": 68 | imv = getactualimage() 69 | ghv = getreleasegh() 70 | npv, rv = checknpm() 71 | process(imv, ghv, npv, rv) 72 | --------------------------------------------------------------------------------