FROM golang:latest

RUN apt-get update -qq && apt-get install -y netcat
RUN apt-get install -y -q libsm6 libcups2 libcairo2 libdbus-1-3 libxinerama1


## Download pandoc and LibreOffice

WORKDIR /tmp
RUN wget https://github.com/jgm/pandoc/releases/download/2.7.3/pandoc-2.7.3-1-amd64.deb
#RUN wget https://download.documentfoundation.org/libreoffice/stable/7.4.0/deb/x86_64/LibreOffice_7.4.0_Linux_x86-64_deb.tar.gz
#RUN tar xvzf LibreOffice_7.4.0_Linux_x86-64_deb.tar.gz


#WORKDIR LibreOffice_7.4.0.3_Linux_x86-64_deb/DEBS

## Install LibreOffice

# RUN dpkg -i *.deb
# RUN ln -s /usr/local/bin/libreoffice7.0 /usr/local/bin/libreoffice

## Install pandoc

WORKDIR /tmp
RUN dpkg -i ./pandoc-2.7.3-1-amd64.deb
    
ENV PATH=$PATH:/src/karmen/core
RUN mkdir -p /src/karmen/core/
ADD . /src/karmen/core

# COPY config/config.yaml /src/karmen/core/config/

WORKDIR /src/karmen/core/

RUN go build -o server *.go
ENTRYPOINT ["/src/karmen/core/server"]

# VOLUME /go/src/gogs.carduccidante.edu.it/karmen/core/config
# VOLUME /go/src/gogs.carduccidante.edu.it/karmen/core/documents

EXPOSE 3000
