drop bash + clean

This commit is contained in:
urielch 2019-04-08 22:08:38 +03:00
parent e0cddbc00f
commit 03a0c9f6e4
6 changed files with 38 additions and 50 deletions

View File

@ -14,7 +14,7 @@ ADD res/setup_10.x /tmp/
RUN \
sed -i s@http://archive\.ubuntu\.com/ubuntu/@mirror://mirrors.ubuntu.com/mirrors.txt@ /etc/apt/sources.list &&\
apt-get update && apt-get install -y --no-install-recommends apt-utils gnupg2 &&\
cat /tmp/setup_10.x | bash - &&\
cat /tmp/setup_10.x | sh - &&\
apt-get update &&\
apt-get install -y curl xvfb nodejs pulseaudio x11vnc xdg-utils libnss3 wget libnspr4 libcairo2 libatk1.0-0 fonts-liberation libappindicator3-1 libatk-bridge2.0-0 libpango-1.0-0 fluxbox wmctrl chromium-browser &&\
apt-get clean &&\
@ -33,6 +33,6 @@ RUN chmod +x /*.sh
USER chrome
EXPOSE 5900
# ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]
# ENTRYPOINT ["/bin/sh", "/entrypoint.sh"]
ENTRYPOINT ["/chomevnc.sh"]

View File

@ -4,35 +4,31 @@ A multi-arch Docker chome VNC
## Build Steps
### Build and download dependences
```bash
# clean old files
sudo rm -rf res; mkdir -p res;
#
docker build -f dep.Dockerfile -t urielch/build-plugin .
docker run --rm -i -v $(pwd)/res:/opt --name tmp-compiler urielch/build-plugin /dl.sh
ls -lh res
```
### Build and test images
```bash
docker build -f 1.Dockerfile -t urielch/chrome-vnc:$(dpkg --print-architecture) .
docker run -p 5900:5900 --name chrome urielch/chrome-vnc:$(dpkg --print-architecture)
docker exec -it chrome bash
docker rm -f chrome
docker build -t urielch/chrome-vnc:latest .
```sh
docker build -f ubuntu.Dockerfile -t urielch/chrome-vnc:ubuntu-$(dpkg --print-architecture) .
docker build -f alpine.Dockerfile -t urielch/chrome-vnc:alpine-$(dpkg --print-architecture) .
```
### try it on a hevy website
```sh
docker run -d --rm -p 5900:5900 -e EXTRA_CHROME_OPTION="--lang=fr-FR,fr" -e X11_W=1024 -e X11_H=768 -e LANG="fr_FR.UTF-8" -e LC_ALL="fr_FR.UTF-8" -e URL=https://maps.google.fr --name chrome-ubu urielch/chrome-vnc:ubuntu-$(dpkg --print-architecture)
docker run -d --rm -p 5901:5900 -e EXTRA_CHROME_OPTION="--lang=fr-FR,fr" -e X11_W=1024 -e X11_H=768 -e LANG="fr_FR.UTF-8" -e LC_ALL="fr_FR.UTF-8" -e URL=https://maps.google.fr --name chrome-alp urielch/chrome-vnc:alpine-$(dpkg --print-architecture)
```
```sh
xvnc4viewer 127.0.0.1:0 &
xvnc4viewer 127.0.0.1:1 &
```
### Upload arch images
```bash
```sh
docker login
docker push urielch/chrome-vnc:$(dpkg --print-architecture)
docker push urielch/chrome-vnc:ubuntu-$(dpkg --print-architecture)
docker push urielch/chrome-vnc:alpine-$(dpkg --print-architecture)
```
### Update multiArch Docker tag
@ -44,7 +40,7 @@ edit ~/.docker/config.json add:
}
```
```bash
```sh
docker rmi urielch/chrome-vnc:latest
docker manifest inspect urielch/chrome-vnc:latest
docker manifest create --amend urielch/chrome-vnc:latest urielch/chrome-vnc:amd64 urielch/chrome-vnc:armhf
@ -53,14 +49,14 @@ docker manifest --purge push urielch/chrome-vnc:latest
### Test multi arch image
```bash
```sh
docker pull urielch/chrome-vnc:latest
docker run -p 5900:5900 --name chrome urielch/chrome-vnc:latest
```
### Cleanup images
```bash
```sh
docker rm $(docker ps -a -q)
docker rmi $(docker images -q)
```

View File

@ -1,10 +1,6 @@
FROM alpine:3.9
LABEL maintainer="urielCh <admin@uriel.ovh>"
ENV LC_ALL="C.UTF-8" \
LANG="en_US.UTF-8" \
LANGUAGE="en_US.UTF-8"
RUN apk add --no-cache xvfb pulseaudio supervisor x11vnc xdg-utils wget chromium nodejs
RUN set -ex;\
@ -20,6 +16,7 @@ RUN chmod +x /*.sh
VOLUME ["/home/chrome"]
EXPOSE 5900
USER root
ENTRYPOINT ["/bin/sh", "/entrypoint.sh"]
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
# Based on: http://www.richud.com/wiki/Ubuntu_Fluxbox_GUI_with_x11vnc_and_Xvfb

View File

@ -1,4 +1,8 @@
#!/bin/sh
echo Knowns env variables: X11_W, X11_H, EXTRA_CHROME_OPTION, URL, PASSWORD
echo Knowns secret: URL, vncpasswd
echo
set -e
. ./env.sh
# VNC default no password
@ -9,14 +13,14 @@ export X11VNC_AUTH="-nopw"
# look for VNC password file in order (first match is used)
for passwd_file in /home/chrome/.vnc/passwd /run/secrets/vncpasswd; do
if [[ -f ${passwd_file} ]]; then
if [ -f ${passwd_file} ]; then
export X11VNC_AUTH="-rfbauth ${passwd_file}"
break
fi
done
# override above if VNC_PASSWORD env var is set (insecure!)
if [[ "$PASSWORD" != "" ]]; then
if [ "$PASSWORD" != "" ]; then
echo $PASSWORD > /tmp/password
export X11VNC_AUTH="-rfbauth /tmp/password"
# export X11VNC_AUTH="-passwd $PASSWORD"

View File

@ -2,32 +2,22 @@ FROM ubuntu:18.10
LABEL maintainer="urielCh <admin@uriel.ovh>"
ENV DEBIAN_FRONTEND="noninteractive" \
LC_ALL="C.UTF-8" \
LANG="en_US.UTF-8" \
LANGUAGE="en_US.UTF-8"
# sed -i s@http://archive\.ubuntu\.com/ubuntu/@mirror://mirrors.ubuntu.com/mirrors.txt@ /etc/apt/sources.list;\
LC_ALL="C.UTF-8"
RUN set -ex;\
apt-get update;\
echo ;\
echo installing other packages;\
echo ;\
optsDeps="iputils-ping net-tools apt-utils";\
apt-get install -y xvfb fonts-takao pulseaudio supervisor x11vnc xdg-utils libnss3 libnspr4 libcairo2 libatk1.0-0 fonts-liberation libappindicator3-1 libatk-bridge2.0-0 libpango-1.0-0 wget $optsDeps chromium-browser;\
optsDeps="iputils-ping net-tools";\
apt-get install -y xvfb pulseaudio supervisor x11vnc wget $optsDeps chromium-browser;\
rm -rf /var/cache/* /var/log/apt/* /var/lib/apt/lists/*;
# ca-certificates
#RUN set -ex;\
# apt-get update;\
# commonsDeps="curl wget";\
# optsDeps="iputils-ping net-tools apt-utils";\
# apt-get install -y $commonsDeps $optsDeps chromium-browser;\
# rm -rf /var/cache/* /var/log/apt/* /var/lib/apt/lists/*;
# pulseaudio
# xdg-utils libnss3 libnspr4 libcairo2 libatk1.0-0 fonts-liberation libappindicator3-1 libatk-bridge2.0-0 libpango-1.0-0 fonts-takao
RUN set -ex;\
echo setup node; \
wget -qO- https://deb.nodesource.com/setup_10.x | /bin/bash -;\
wget -qO- https://deb.nodesource.com/setup_10.x | /bin/sh -;\
apt-get install -y nodejs;\
rm -rf /var/cache/* /var/log/apt/* /var/lib/apt/lists/*;
@ -47,6 +37,7 @@ RUN chmod +x /*.sh
VOLUME ["/home/chrome"]
EXPOSE 5900
USER root
ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]
ENTRYPOINT ["/bin/sh", "/entrypoint.sh"]
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]