Skip to content

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
bitmeal committed May 27, 2021
0 parents commit 9a4f9ab
Show file tree
Hide file tree
Showing 17 changed files with 685 additions and 0 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
7 changes: 7 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto

# Declare files that will always have CRLF line endings on checkout.

# Declare files that will always have LF line endings on checkout.
*.init text eol=lf
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.vscode/
node_modules/
71 changes: 71 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
FROM phusion/baseimage:master as init
# clean way to get newest init

FROM node:slim

# setup
ARG APT_FLAGS="-q -y --no-install-recommends"
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update -q

# system deps
RUN apt-get install -q -y python3-minimal
# RUN apt-get install $APT_FLAGS python3 python3-pip wheel

# init
COPY --from=init /sbin/my_init /sbin/my_init
RUN apt-get install $APT_FLAGS runit
# RUN \
# sed -i 's%usr/bin%sbin%g' /sbin/my_init && sed -i '1s%.*%#!/usr/bin/python3 -u%' /sbin/my_init && \
RUN \
chmod +x /sbin/my_init && \
mkdir -p /etc/my_init.d && \
mkdir -p /etc/my_init.pre_shutdown.d && \
mkdir -p /etc/my_init.post_shutdown.d

# xvfb
ENV DISPLAY=:99
COPY services/xvfb.init /etc/service/xvfb/run
RUN \
apt-get install $APT_FLAGS xvfb && \
chmod +x /etc/service/xvfb/run


# puppeteer/chromium
RUN apt-get install $APT_FLAGS libnss3 libgtk-3-0 libgbm-dev libasound2
COPY services/puppeteer.init /etc/service/puppeteer/run
COPY puppeteer /opt/puppeteer
WORKDIR /opt/puppeteer
RUN \
npm install && \
chmod +x /etc/service/puppeteer/run
WORKDIR /


# dbus
# COPY services/dbus.init /etc/service/dbus/run
# RUN \
# apt-get install $APT_FLAGS dbus && \
# mkdir -pv /var/run/dbus && \
# chmod +x /etc/service/dbus/run

# dbus mock (upower) [remember to install pip]
# COPY services/dbus_upower.init /etc/service/dbus_upower/run
# RUN \
# pip3 install dbus-python python-dbusmock && \
# chmod +x /etc/service/dbus_upower/run

# headfull proxy
ENV PORT 9222
ENV PORT_INTERNAL 9992
COPY services/proxy.init /etc/service/proxy/run
RUN \
apt-get install $APT_FLAGS socat && \
chmod +x /etc/service/proxy/run

# cleanup
RUN apt-get autoremove && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# exec
ENTRYPOINT ["/sbin/my_init", "--"]
CMD []
Loading

0 comments on commit 9a4f9ab

Please sign in to comment.