Skip to content

Commit 047b1a9

Browse files
committed
Initial Dockerfile and docs
1 parent 0b0b73e commit 047b1a9

File tree

3 files changed

+103
-1
lines changed

3 files changed

+103
-1
lines changed

Dockerfile

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Extend the Docksal CLI per https://docs.docksal.io/stack/extend-images/
2+
#
3+
# Note how we use cli:2 here, which refers the latest available 2.x version
4+
# So that we wouldn't need to update this every time new version of Docksal cli releases
5+
FROM docksal/cli:2-php7.3
6+
7+
# Puppeteer dependencies taken from https://github.com/alekzonder/docker-puppeteer
8+
# Install addtional apt packages needed for pa11y and puppeteer
9+
# Added vim.
10+
RUN apt-get update && \
11+
apt-get install -yq gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \
12+
libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \
13+
libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 \
14+
libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 \
15+
fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst \
16+
ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget vim && \
17+
apt-get --purge remove && \
18+
apt-get clean && apt-get autoremove -y && rm -rf /var/lib/apt/lists/*
19+
20+
# All further commands will be performed as the docker user.
21+
USER docker
22+
SHELL ["/bin/bash", "-c"]
23+
24+
# Remove ruby from Docksal CLI
25+
RUN \
26+
# Initialize the user environment (this loads rvm)
27+
. $HOME/.profile && \
28+
rvm remove ruby-${RUBY_VERSION_INSTALL}
29+
30+
# Install additional global npm dependencies
31+
RUN \
32+
# Initialize the user environment (this loads nvm)
33+
. $HOME/.profile && \
34+
# Install node packages
35+
npm install -g [email protected] pa11y@5 pa11y-ci@2
36+
37+
# IMPORTANT! Switching back to the root user as the last instruction.
38+
USER root

README.md

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,62 @@
1-
# docker-cli
1+
# Outrigger cli
2+
3+
> Docker image adding pa11y and other common tools to [Docksal CLI](https://github.com/docksal/service-cli).
4+
5+
[![GitHub tag](https://img.shields.io/github/tag/phase2/docker-cli.svg)](https://github.com/phase2/docker-cli) [![Docker Stars](https://img.shields.io/docker/stars/outrigger/cli.svg)](https://hub.docker.com/r/outrigger/cli) [![Docker Pulls](https://img.shields.io/docker/pulls/outrigger/cli.svg)](https://hub.docker.com/r/outrigger/cli) [![](https://images.microbadger.com/badges/image/outrigger/cli:dev.svg)](https://microbadger.com/images/outrigger/cli:dev "Get your own image badge on microbadger.com")
6+
7+
This Docker image adds the following tools to the docksal/cli image:
8+
* [pa11y v5](https://github.com/pa11y/pa11y)
9+
* [puppeteer v1.2](https://github.com/puppeteer/puppeteer) (needs testing with v2.x)
10+
* vim
11+
12+
## Using pa11y with Docksal
13+
14+
In the project `.docksal/docksal.env` set the following:
15+
16+
```
17+
CLI_IMAGE='outrigger/cli'
18+
```
19+
20+
Then start your project with `fin start`. Once the containers have started, run
21+
the webpack-dev-server for your theme:
22+
23+
```
24+
cd THEME_PATH
25+
fin exec npm run theme
26+
```
27+
where the `theme` job is defined in `package.json` as:
28+
```
29+
scripts:
30+
"theme": "cross-env-shell NODE_ENV=development \"webpack-dev-server --config ./webpack.config.js --hot\"",
31+
```
32+
33+
This will use your webpack config and enter watch mode to recompile when changes
34+
are detected to your theme files.
35+
36+
Once the theme has compiled and the webpack-dev-server is running, execute pa11y
37+
tests via:
38+
39+
```
40+
fin exec npm run pa11y
41+
```
42+
where the `pa11y` job is defined in `package.json` as:
43+
```
44+
scripts:
45+
"pa11y": "pa11y-ci --config pa11y.js"
46+
```
47+
48+
## Resources
49+
50+
* General questions on Docksal should go to the [docksal documenation](https://docs.docksal.io/)
51+
* General issues on Puppeteer should check out the [base Puppeteer image](https://hub.docker.com/r/alekzonder/puppeteer/). Note: you can follow the instructions in that README to take screenshots. Since this image is based on that, you should not need a further Docker iamge download.
52+
* [Puppeteer Github Project](https://github.com/GoogleChrome/puppeteer)
53+
* [Official Puppeteer Docker guidance](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#running-puppeteer-in-docker)
54+
* [pa11y @ Github](https://github.com/pa11y/pa11y)
55+
56+
## Security Reports
57+
58+
Please email [email protected] with security concerns.
59+
60+
## Maintainers
61+
62+
[![Phase2 Logo](https://s3.amazonaws.com/phase2.public/logos/phase2-logo.png)](https://www.phase2technology.com)

build.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
docker build -t outrigger/cli .

0 commit comments

Comments
 (0)