Skip to content

Instantly share code, notes, and snippets.

@linktohack
Created December 16, 2016 15:33
Show Gist options
  • Save linktohack/6140e842f602d0b25948462c98f33fe2 to your computer and use it in GitHub Desktop.
Save linktohack/6140e842f602d0b25948462c98f33fe2 to your computer and use it in GitHub Desktop.
Dockerfile
FROM resin/%%RESIN_MACHINE_NAME%%-node
ENV DEBIAN_FRONTEND noninteractive
# Instal MySQL Server
RUN echo mysql-server mysql-server/root_password password root | debconf-set-selections;\
echo mysql-server mysql-server/root_password_again password root | debconf-set-selections;
RUN apt-get update && apt-get install -yq mysql-server mysql-client libmysqlclient-dev
RUN sed -i -e "s@^datadir.*@datadir = /data/mysql@" /etc/mysql/my.cnf
RUN sed -i -e "s@^bind-address.*@#bind-address = 0.0.0.0@" /etc/mysql/my.cnf
# Install other apt deps
RUN apt-get update && apt-get install -yq \
apt-utils \
build-essential \
clang \
xserver-xorg-core \
xserver-xorg-input-all \
xserver-xorg-video-fbdev \
xorg \
libdbus-1-dev \
libgtk2.0-dev \
libnotify-dev \
libgnome-keyring-dev \
libgconf2-dev \
libasound2-dev \
libcap-dev \
libcups2-dev \
libxtst-dev \
libxss1 \
libnss3-dev \
fluxbox \
libsmbclient \
libssh-4 \
fbset \
libudev-dev \
libusb-1.0-0-dev \
python-imaging \
python-serial \
python-setuptools \
libexpat-dev \
python \
python-pip && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -yq python-dev && rm -rf /var/lib/apt/lists/*
RUN pip install pyusb
RUN pip install pytz
WORKDIR /tmp
RUN git clone https://github.com/lincolnloop/python-qrcode
WORKDIR /tmp/python-qrcode
RUN python setup.py build
RUN python setup.py install
WORKDIR /tmp
RUN git clone --recursive https://github.com/manpaz/python-escpos.git
WORKDIR /tmp/python-escpos
RUN python setup.py build
RUN python setup.py install
# Set Xorg and FLUXBOX preferences
RUN mkdir ~/.fluxbox
RUN echo "xset s off" > ~/.fluxbox/startup && echo "xserver-command=X -s 0 dpms" >> ~/.fluxbox/startup
RUN echo "#!/bin/bash" > /etc/X11/xinit/xserverrc \
&& echo "" >> /etc/X11/xinit/xserverrc \
&& echo 'exec /usr/bin/X -s 0 dpms -nocursor -nolisten tcp "$@"' >> /etc/X11/xinit/xserverrc
# Set npm
RUN npm config set unsafe-perm true
# Save source folder
RUN printf "%s\n" "${PWD##}" > SOURCEFOLDER
# Move to app dir
WORKDIR /usr/src/app
# Move package.json to filesystem
COPY "$SOURCEFOLDER/app/package.json" ./
# NPM i app
RUN JOBS=MAX npm i --production
# Move app to filesystem
COPY "$SOURCEFOLDER/app" ./
# NPM rebuild node native modules after electron is installed.
RUN ./node_modules/.bin/electron-rebuild
## uncomment if you want systemd
ENV INITSYSTEM on
RUN chmod +x install-rtc.sh
RUN ./install-rtc.sh
# Start app
CMD ["bash", "/usr/src/app/start.sh"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment