Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce devcontainer.json #710

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .devcontainer/Dockerfile
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like that this is a duplicate / near-duplicate of Dockerfile in the root. Can it be a symlink or otherwise deduplicated (e.g. by importing one Dockerfile into another)? Otherwise it's a bitrot hazard (because most devs are unlikely to be using both of them).

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM debian:latest

RUN apt-get update \
&& apt-get install -y \
gawk \
perl \
sed \
git \
python3 \
python3-pip \
pandoc \
biber \
latexmk \
texlive \
texlive-science \
texlive-fonts-extra \
texlive-plain-generic \
texlive-bibtex-extra \
&& apt-get clean

# Install Python packages, after removing a file that breaks pip.
RUN rm /usr/lib/python3.11/EXTERNALLY-MANAGED
RUN pip install rst2html5 \
&& pip install docutils==0.19

RUN apt-get install -y locales \
&& echo "LC_ALL=en_US.UTF-8" >> /etc/environment \
&& echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \
&& echo "LANG=en_US.UTF-8" > /etc/locale.conf \
&& locale-gen en_US.UTF-8

ENV PATH=${PATH}:/usr/local/bin
4 changes: 4 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "Dev space",
"dockerFile": "Dockerfile"
}
7 changes: 6 additions & 1 deletion .github/actions/render/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,9 @@ author: Deirdre Connolly
runs:
using: docker
# Runs `make all` or something like it
image: ../../../Dockerfile
image: ../../../.devcontainer/Dockerfile
args:
- /bin/sh
- -c
- make
- all
26 changes: 0 additions & 26 deletions Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ discard:

define PROCESSRST
$(eval TITLE := $(shell echo '$(patsubst zips/%,%,$(basename $<))' | sed -E 's|zip-0{0,3}|ZIP |;s|draft-|Draft |')$(shell grep -E '^(\.\.)?\s*Title: ' $< |sed -E 's|.*Title||'))
rst2html5 -v --title="$(TITLE)" $< >$@
rst2html5.py -v --title="$(TITLE)" $< >$@
./edithtml.sh --rst $@
endef

Expand Down
2 changes: 2 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ Use ``make`` to check that you are using correct
and double-check the generated ``rendered/draft-*.html`` file before filing a Pull Request.
See `here <protocol/README.rst>`__ for the project dependencies.

Consider leveraging `our devcontainer.json <devcontainer.rst>`__ for ease of tool aquisition
when working in this repo.

NU7 Candidate ZIPs
------------------
Expand Down
2 changes: 2 additions & 0 deletions README.template
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ Use ``make`` to check that you are using correct
and double-check the generated ``rendered/draft-*.html`` file before filing a Pull Request.
See `here <protocol/README.rst>`__ for the project dependencies.

Consider leveraging `our devcontainer.json <devcontainer.rst>`__ for ease of tool aquisition
when working in this repo.

NU7 Candidate ZIPs
------------------
Expand Down
20 changes: 20 additions & 0 deletions devcontainer.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Using dev containers for editing this repo

This repo uses devcontainer.json to ease configuring the tools necessary to run ``make``.
You can use [Codespaces](https://docs.github.com/en/codespaces/developing-in-codespaces/developing-in-a-codespace)
to make your contributions and validate your work.
Or when using VS Code, use the "Dev Containers: Reopen in Container" command to create
the docker container with the tools.

## VS Code experience

When using VS Code to edit .rst files, the following extensions will add a preview pane,
and otherwise add tooling for the files you may be editing:

- [Makefile Tools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.makefile-tools)
- [reStructuredText](https://marketplace.visualstudio.com/items?itemName=lextudio.restructuredtext)
- [Python](https://marketplace.visualstudio.com/items?itemName=ms-python.python)
- [reStructuredText Syntax highlighting](https://marketplace.visualstudio.com/items?itemName=trond-snekvik.simple-rst)
- [Docker](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker)

Note that these extensions are not endorsed nor been vetted by the Zcash Foundation.
4 changes: 2 additions & 2 deletions render-via-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ set -efuxo pipefail

TAG='zcash-zips-render'

docker build -t "$TAG" .
docker run -v "$(pwd):/zips" "$TAG"
docker build -t "$TAG" .devcontainer
docker run -v "$(pwd):/zips" "$TAG" -w /zips make all