Skip to content

Commit

Permalink
Merge pull request #15 from OliverKillane/enh/development-docker
Browse files Browse the repository at this point in the history
Docker Based Development
  • Loading branch information
OliverKillane authored Sep 28, 2023
2 parents 765d72f + e507e3f commit 603e1c5
Show file tree
Hide file tree
Showing 8 changed files with 222 additions and 65 deletions.
50 changes: 50 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
FROM debian:bookworm-slim


# Install basic packages
RUN apt-get update -q
RUN apt-get install -qy build-essential wget curl sudo openssh-client git

# LATEX:
# Install full texlive distribution (very large)
ARG TL_VERSION=2023
ARG TL_MIRROR=https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
RUN cd /tmp && \
wget --directory-prefix /tmp ${TL_MIRROR} && \
zcat < install-tl-unx.tar.gz | tar xf - && \
cd install-tl-* && \
perl ./install-tl --no-interaction --no-doc-install --no-src-install
ENV PATH="${PATH}:/usr/local/texlive/${TL_VERSION}/bin/x86_64-linux"

# Update packages and tlmgr
RUN tlmgr init-usertree
RUN tlmgr update --self --all
RUN tlmgr install latexindent chktex

# install inkscape (for tikz) and minted (for code highlighting)
RUN apt-get install -qy inkscape python3 python3-pip pipx
RUN pipx install pygments

# C++
# Already installed GCC as part of build-essential
RUN apt-get install -qy clang-format

# Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -qy

# Elixir
RUN apt-get install -qy elixir

# TLA
# Required Java, toolbox used is included in the VSCode extension
RUN apt-get install -qy default-jdk

# Haskell
RUN apt-get install -qy libffi-dev libffi8ubuntu1 libgmp-dev libgmp10 libncurses-dev libncurses5 libtinfo5
RUN curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_GHC_VERSION=latest BOOTSTRAP_HASKELL_CABAL_VERSION=latest BOOTSTRAP_HASKELL_INSTALL_STACK=1 BOOTSTRAP_HASKELL_INSTALL_HLS=1 BOOTSTRAP_HASKELL_ADJUST_BASHRC=P sh

# Clean up to reduce image size
RUN apt-get clean autoclean && apt-get autoremove -y
RUN rm -rf /var/lib/{apt,dpkg,cache,log}/ /tmp/* /usr/local/texlive/${TL_VERSION}/*.log

CMD /usr/bin/bash
69 changes: 69 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"image": "ghcr.io/oliverkillane/imperial-computing-notes-dev",
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {
"version": "latest"
}
},
"customizations": {
"vscode": {
"settings": {
"latex-workshop.linting.chktex.enabled": true,
"latex-workshop.latex.tools": [
{
"name": "latexmk",
"command": "latexmk",
"args": [
"-shell-escape",
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-pdf",
"-outdir=%OUTDIR%",
"%DOC%"
],
"env": {}
}
],
"editor.rulers": [
{
"column": 80, // spacing of 1st column from left
"color": "#ff9900" // orange, Go Vols!
},
{
"column": 100, // spacing of 1st column from left
"color": "#ff0000" // orange, Go Vols!
}
]
},
"extensions": [
// For latex vscode setup
"James-Yu.latex-workshop",
// Development Ease
"usernamehw.errorlens",
"GitHub.vscode-pull-request-github",
"GitHub.github-vscode-theme",
"GitHub.vscode-github-actions",
// Diagrams done with drawio
"hediet.vscode-drawio",
// Language Support
"llvm-vs-code-extensions.vscode-clangd",
"ms-vscode.cmake-tools",
"JakeBecker.elixir-ls",
"ms-python.python",
"ms-python.black-formatter",
"rust-lang.rust-analyzer",
"serayuzgur.crates",
"haskell.haskell",
"alygin.vscode-tlaplus"
]
}
},
"mounts": [
// {
// "source": "${localEnv:HOME}/.ssh",
// "target": "/root/.ssh",
// "type": "bind"
// }
]
}
17 changes: 17 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## Develop

### From Github Codespaces
Given you have github pro (e.g through the student developer pack)
1. Open the repository in a new codespace
2. Setup git, ssh *...and you're done*

### From Devcontainer
See the provided [container](../.devcontainer).
1. Install docker desktop
2. Install vscode and the [Dev Container Extension](vscode:extension/ms-vscode-remote.remote-containers)
3. Clone this repository, and open within a devcontainer.
4. Setup git, ssh *...and you're done*

### Locally
Please use the dockerfile and vscode features from the [container setup](../.devcontainer) as a guide.
- @oliverkillane is using MikTex + vscode + wsl on Windows
4 changes: 4 additions & 0 deletions .github/issue_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## Description
*{A short description of the issue here}*

*{Include references to incorrect information (to file, line in latex)}*
10 changes: 10 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## Goals
- [ ] Increase the flubbo of the foobar
- [x] Re-jingle the plorb (without wazzo deractance)
- Only semi-jingled, decided against replacement due to additional build complexity

> :eyes: **Please see zarg formatting** (decreased cadence)
## Chores
- [ ] PDFs regenerated
- [ ] Reformatted
50 changes: 50 additions & 0 deletions .github/workflows/push-dev-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build and Publish Image
run-name: Pushing new Imperial College Notes Devcontainer by @${{ github.actor }}
on:
push:
branches:
- enh/development-docker
paths:
- '.devcontainer/Dockerfile'

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
sparse-checkout: .devcontainer/Dockerfile
sparse-checkout-cone-mode: false
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Enrich Metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/oliverkillane/imperial-computing-notes-dev
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
flavor: |
latest=true
labels: |
org.opencontainers.image.description=A development image for the imperial computing notes
org.opencontainers.image.vendor=Imperial Computing Notes
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.IMPERIAL_NOTES_GHCR_TOKEN }}
- name: Build and Push Image
uses: docker/build-push-action@v5
with:
context: .devcontainer
push: true
platforms: linux/amd64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
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) 2023 Oliver Killane

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.
66 changes: 1 addition & 65 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,69 +16,5 @@ It is designed as an improvement in quality over the [second year repo](https://
- [60029 - Data Processing Systems](60029%20-%20Data%20Processing%20Systems)

## How do I build this?
### Dependencies
1. A tex distribution. [See options here](https://www.latex-project.org/get/)

2. Inkscape (required for tikz). Needs to be added to path
```powershell
# Check inkscape is installed and on path
inkscape --version
```

3. [Pygments](https://pygments.org/) - used by minted (code listings), which requires [python & pip](https://www.python.org/downloads/).
```powershell
pip install Pygments
```

4. Correctly configured editor (minted and tikz need shell escape).

5. `latexindent` for code formatting

6. [draw.io](https://app.diagrams.net/) for diagrams. This can also be downloaded.

### My Setup
I am editing on windows 11.
1. Tex Distribution is [MikTex](https://miktex.org/).
2. Inkscape 0.92.4 installed from, their website. `C:\Program Files\Inkscape` added to `Path`.
3. Python 3.10.7 installed with Pip 22.2.2. Pygments 2.13.0 installed.
5. I use wsl as my default terminal, so I run latexindent from there as part of texlive.
```bash
sudo apt install texlive-extra-utils
```
4. I edit using VSCode using the [Latex Workshop extension](https://marketplace.visualstudio.com/items?itemName=James-Yu.latex-workshop). To allow shell escape I have added:
```json
{
...

"latex-workshop.latex.tools": [
{
"name": "latexmk",
"command": "latexmk",
"args": [
"-shell-escape", // Shell Escape enabled!
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-pdf",
"-outdir=%OUTDIR%",
"%DOC%"
],
"env": {}
},
...
],
...
}
```

## I've found a mistake!
Simply [add a new issue](https://github.com/OliverKillane/Imperial-Computing-Year-3-Notes/issues/new/choose) and attach the relevant labels.

![Screenshot 2022-10-09 015053](https://user-images.githubusercontent.com/44177991/194732526-54cca108-9fa7-4b0e-a4af-b0baad625af9.png)

## I want to contribute!
Fork the repository and create a [pull request](https://github.com/OliverKillane/Imperial-Computing-Year-3-Notes/pulls).
- I will review as soon as I can
- PRs need to be formatted correctly (using latexindent)
- If there are merge conflicts, rebase!
- PDFs need to be rebuilt.
## [I want to contribute!](./.github/CONTRIBUTING.md)

0 comments on commit 603e1c5

Please sign in to comment.