Skip to content

Commit

Permalink
Add the beginnings of a test suite - need to look into adding GitHub …
Browse files Browse the repository at this point in the history
…Actions.

Fix local error with streaming .wasm files without proper MIME type set.
Run prettier over entire codebase.
Add accessibility for xterm.js and Codemirror.
  • Loading branch information
dom111 committed May 11, 2022
1 parent 48c70ca commit aa09a47
Show file tree
Hide file tree
Showing 32 changed files with 12,682 additions and 884 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.idea
node_modules
build/
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
dist
js/lib
package-lock.json
19 changes: 19 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
SHELL = /bin/bash

.PHONY: build
build: docker-compose.override.yml
docker-compose run --rm web npm run build

.PHONY: test
test: docker-compose.override.yml
docker-compose run --rm test npm run test

docker-compose.override.yml:
@echo "version: '3'" > docker-compose.override.yml
@echo >> docker-compose.override.yml
@echo "services:" >> docker-compose.override.yml
@echo " web:" >> docker-compose.override.yml
@echo " user: `id -u`:`id -g`" >> docker-compose.override.yml

dist/js/app.js:
dist/js/app.js: build
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Run code in your browser (via WASM) outputting the results to xterm.js to allow

## Currently supported:

- Perl 5.28.1 (via webperl)
- JavaScript (via a worker)
- Perl 5.28.1 (via webperl)
- JavaScript (via a worker)

## TODO

Expand Down
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
theme: jekyll-theme-slate
theme: jekyll-theme-slate
2 changes: 1 addition & 1 deletion dist/js/app.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/js/app.js.map

Large diffs are not rendered by default.

22 changes: 20 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,27 @@
version: "3.1"
version: '3.1'

services:
web:
image: httpd:2.4-alpine
image: code-sandbox
volumes:
- ./:/usr/local/apache2/htdocs
- ./docker/web/httpd.conf:/usr/local/apache2/conf/httpd.conf
build:
context: ./docker/web/
ports:
- 8000:80

test:
image: code-sandbox-test
volumes:
- ./:/src/
build:
context: ./docker/test/
depends_on:
- web
links:
- web
# https://stackoverflow.com/a/53975412/3145856
# https://github.com/docker/compose/issues/5574
security_opt:
- seccomp:"./docker/test/chrome.json"
49 changes: 49 additions & 0 deletions docker/test/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
FROM node:slim

# Install latest chrome dev package and fonts to support major charsets (Chinese, Japanese, Arabic, Hebrew, Thai and a few others)
# Note: this installs the necessary libs to make the bundled version of Chromium that Puppeteer
# installs, work.
RUN apt-get update \
&& apt-get install -y wget gnupg \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \
&& apt-get install -y google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*

# If running Docker >= 1.13.0 use docker run's --init arg to reap zombie processes, otherwise
# uncomment the following lines to have `dumb-init` as PID 1
# ADD https://github.com/Yelp/dumb-init/releases/download/v1.2.2/dumb-init_1.2.2_x86_64 /usr/local/bin/dumb-init
# RUN chmod +x /usr/local/bin/dumb-init
# ENTRYPOINT ["dumb-init", "--"]

# Uncomment to skip the chromium download when installing puppeteer. If you do,
# you'll need to launch puppeteer with:
# browser.launch({executablePath: 'google-chrome-stable'})
# ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true

WORKDIR /home/pptruser

# Install puppeteer so it's available in the container.
RUN npm install -g npm@latest \
&& npm init -y \
&& npm i puppeteer \
# Add user so we don't need --no-sandbox.
# same layer as npm install to keep re-chowned files from using up several hundred MBs more space
&& groupadd -r pptruser && useradd -r -g pptruser -G audio,video pptruser \
&& mkdir -p /home/pptruser/Downloads \
&& chown -R pptruser:pptruser /home/pptruser \
&& chmod -R 777 /tmp \
&& apt-get update \
&& apt-get install -y socat \
&& npm config set update-notifier false

COPY ./entrypoint.sh /usr/local/bin/entrypoint.sh

RUN chmod +x /usr/local/bin/entrypoint.sh

# Run everything after as non-privileged user.
USER pptruser

ENTRYPOINT ["bash", "/usr/local/bin/entrypoint.sh"]
Loading

0 comments on commit aa09a47

Please sign in to comment.