jef/streetmerchant

Create binaries for Windows, macOS, and Linux

jef opened this issue ยท 9 comments

jef commented

Description

It'd be better to create binaries and distribute through Releases in GitHub rather than people download Node.js and go through npm.

Possible solution

Use pkg or something similar.

I got close to a working docker build, but the chromium sandbox doesn't seem to work well in the container.

from ubuntu:20.04

env debian_frontend=noninteractive
run apt update && apt install -y git curl \
	libglib2.0-0 libnss3 libatk1.0-0 libatk-bridge2.0-0 libx11-xcb1 libxcb-dri3-0 \
	libxcomposite1 libxdamage1 libxfixes3 libcups2 libdrm2 libxrandr2 libgbm1 \
	libasound2 libpangocairo-1.0-0 libgtk3.0-cil

run curl -sL https://deb.nodesource.com/setup_12.x | bash -
run apt install -y nodejs

workdir /home/runner
copy . .
run npm install

run useradd -m runner
run chown -R runner:runner /home/runner 

env SANDBOX="/home/runner/node_modules/puppeteer/.local-chromium/linux-800071/chrome-linux/chrome_sandbox"
run chown root:root ${SANDBOX} && chmod 4755 ${SANDBOX}

user runner
ENV CHROME_DEVEL_SANDBOX=${SANDBOX}
run npm run start
jef commented

but the chromium sandbox doesn't seem to work well in the container

This was my thoughts exactly... I was gonna publish that route and then distribute easier with Docker images, but could run into more problems that way with people's OSes. *nix based machines handle these a lot easier, but could be a problem.

Also I was considering the open dependency. Not sure if it would open unless we did some volume mounting -- and I don't know if that would even work.

I did get sandboxing working in docker. I'll look into x11 forwarding but I think on not linux systems it will require an additional package. It would still be just 2 packages to install and 1 command vs actually building it. we can also set it up to just have a docker build script and then provide commands to extract the finished files out of the container and have it run that.

This is my dockerfile, which works fine in app engine:

FROM node:14-slim

RUN apt-get update \
    && apt-get install -y wget gnupg \
    && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
    && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
    && apt-get update \
    && apt-get install -y google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 \
      --no-install-recommends \
    && rm -rf /var/lib/apt/lists/*

# Install puppeteer so it's available in the container.
RUN npm i puppeteer \
    && 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 /node_modules

# Everything else
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY ./build .
COPY .env ../.
EXPOSE 80

# Run everything after as non-privileged user.
USER pptruser

CMD [ "node", "index.js"]

Quick q. Don't you think that adding binaries will make it easier for people to use this, thus making it easier for companies to find ways to ban tools like this? (based on it's popularity).

Granted, it is the point of open-source so potato potata

Skhmt commented

It opens chromium, goes to the websites, and scrapes them. There's not much they can do to stop this software.

jef commented

making it easier for companies to find ways to ban tools like this

I think this is a positive. It would be unfortunate for this project and would have to shift, but to have merchandisers improve their point of sale based on this sort of project would be awesome!

right. I guess is shouldnt come to this with an exclusivity mindset in mind. +1

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days