Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Hosting dathttpd on now.sh - https://dat.jimpick.com/
sites:
dat.jimpick.com:
url: dat://b61c1b001bb2bc37ceda060895b5023b631dff09ce3486400fbcc2e8f4621951/
datOnly: false
dat-localhost.jimpick.com:
url: dat://b61c1b001bb2bc37ceda060895b5023b631dff09ce3486400fbcc2e8f4621951/
datOnly: false
FROM ubuntu:16.04
RUN apt-get update --yes && apt-get upgrade --yes
RUN apt-get update --yes && apt-get upgrade --yes
RUN apt-get -y install curl
RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
RUN apt-get -y install ffmpeg zlib1g-dev automake autoconf git \
libtool subversion libatlas3-base python-pip \
python-dev wget unzip cowsay git-lfs \
libcairo2-dev libjpeg8-dev libpango1.0-dev libgif-dev \
libpng-dev build-essential g++ vim
RUN apt-get clean
RUN curl https://nodejs.org/dist/v8.1.2/node-v8.1.2-linux-x64.tar.xz | tar xJf - -C /opt
ENV PATH="/opt/node-v8.1.2-linux-x64/bin:${PATH}"
RUN curl -O https://bootstrap.pypa.io/get-pip.py
RUN python get-pip.py
RUN pip install awscli --ignore-installed six
RUN npm install -g json
ENV PATH="/usr/games:${PATH}"
RUN ln -s `which nodejs` /usr/bin/node
# Non-privileged user
RUN useradd -m dathttpd
# Copy files
WORKDIR /home/dathttpd
RUN chown -R dathttpd. .
# Change npm permissions
RUN chown -R dathttpd /opt/node-v8.1.2-linux-x64/lib/node_modules
RUN chown -R dathttpd /opt/node-v8.1.2-linux-x64/bin
RUN chown -R dathttpd /opt/node-v8.1.2-linux-x64/share
# Allow binding to ports 80 and 443 as a regular user
# https://github.com/beakerbrowser/dathttpd
RUN setcap cap_net_bind_service=+ep /opt/node-v8.1.2-linux-x64/bin/node
# Unprivileged
USER dathttpd
RUN npm install -g dathttpd
COPY dathttpd.yml .dathttpd.yml
EXPOSE 80
ENTRYPOINT dathttpd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment