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

Update dockerfile with pa11y-ci #7

Merged
merged 2 commits into from
May 2, 2018
Merged
Changes from 1 commit
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
16 changes: 4 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,14 @@ LABEL maintainer="Phase2 <outrigger@phase2technology.com>" \
org.label-schema.docker.debug="docker exec -it $CONTAINER bash" \
org.label-schema.schema-version="1.0"

# It's a good idea to use dumb-init to help prevent zombie chrome processes.
ADD https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64 /usr/local/bin/dumb-init
RUN chmod +x /usr/local/bin/dumb-init
USER root

# Let's get pa11y v5 in here.
RUN yarn global add pa11y@beta

# Add user so we don't need --no-sandbox.
RUN groupadd -r pptruser && useradd -r -g pptruser -G audio,video pptruser \
&& mkdir -p /home/pptruser/Downloads \
&& chown -R pptruser:pptruser /home/pptruser \
&& chown -R pptruser:pptruser /screenshots \
&& chown -R pptruser:pptruser /usr/local/share/.config/yarn/global/node_modules
Copy link
Contributor

Choose a reason for hiding this comment

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

By dropping these permissions, can the pptuser still take screenshots?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe so, but I have not tested the screenshot capability myself. These permissions are now included in the starting dockerfile here: https://hub.docker.com/r/alekzonder/puppeteer/~/dockerfile/

RUN yarn global add pa11y@5
RUN yarn global add pa11y-ci@2
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we have one of the following to minimize the number of layers?

RUN yarn global add pa11y@5 pa11y-ci@2

or

RUN yarn global add pa11y@5 && yarn global add pa11y-ci@2

Also, is it the case we need to explicitly add pa11y? We can't invoke it if it's a dependency of pa11y-ci?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have confirmed that pa11y needs to be explicitly added. If pa11y-ci gets added globally, that doesn't give access to pa11y globally


USER pptruser

ENTRYPOINT ["dumb-init", "--", "pa11y"]
ENTRYPOINT ["dumb-init", "--"]
Copy link
Contributor

Choose a reason for hiding this comment

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

I like the flexibility here, but if we remove pa11y as part of the entrypoint, the -h flag in command will be an error.

I think we'll need to remove the CMD statement entirely.

This approach leaves us with:

docker run --rm outrigger/pa11y pa11y <url>

or

docker run --rm outrigger/pa11y pa11y-ci

a bit redundant, but we can work with that.

Copy link
Contributor

Choose a reason for hiding this comment

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

From sidebar chat, maybe CMD should be "bash -c"?


CMD ["-h"]