FROM ubuntu:20.04

ARG DEBIAN_FRONTEND=noninteractive

RUN apt clean && apt update
RUN apt install -y golang git build-essential wget curl ngrep unzip file squashfs-tools desktop-file-utils patchelf libxkbcommon-x11-dev libx11-xcb-dev libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render0 libxcb-render-util0 libxcb-shape0 libxcb-sync1 libxcb-xfixes0 libxcb-shm0 libxcb-keysyms1 libxcb-xkb1

RUN go get github.com/probonopd/go-appimage/src/appimagetool
RUN go build -trimpath -ldflags="-s -w" github.com/probonopd/go-appimage/src/appimagetool
RUN chmod +x appimagetool

RUN cd /usr/bin && \
    wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh -O uploadtool && \
    chmod +x uploadtool

RUN cd / && \
    wget -c https://github.com/AppImage/AppImageKit/releases/download/continuous/runtime-x86_64 && \
    chmod +x runtime-x86_64