Skip to content

Instantly share code, notes, and snippets.

@aleksandr-kotlyar
Created February 29, 2020 11:53
Show Gist options
  • Save aleksandr-kotlyar/0bfb7888cbe413b8f06cfaa8066d2e3c to your computer and use it in GitHub Desktop.
Save aleksandr-kotlyar/0bfb7888cbe413b8f06cfaa8066d2e3c to your computer and use it in GitHub Desktop.
python:3.7-alpine + chrome:3.11-alpine
FROM python:3.7-alpine
# install dependencies
USER root
COPY requirements.txt requirements.txt
RUN pip3 install --no-cache-dir -r requirements.txt
# Installs latest Chromium package.
RUN echo @edge http://mirrors.aliyun.com/alpine/v3.11/community > /etc/apk/repositories \
&& echo @edge http://mirrors.aliyun.com/alpine/v3.11/main >> /etc/apk/repositories \
&& apk add --no-cache \
libstdc++@edge \
chromium@edge \
harfbuzz@edge \
nss@edge \
freetype@edge \
ttf-freefont@edge \
&& rm -rf /var/cache/* \
&& mkdir /var/cache/apk
# Add Chrome as a user
RUN mkdir -p /usr/src/app \
&& adduser -D chrome \
&& chown -R chrome:chrome /usr/src/app
# Run Chrome as non-privileged
USER chrome
WORKDIR /usr/src/app
ENV CHROME_BIN=/usr/bin/chromium-browser \
CHROME_PATH=/usr/lib/chromium/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment