Running sbt in a Docker Container - scala

I am trying to use Github actions for my scala project and created a Docker workflow for it. Basically, I am trying to install sbt into my container and run the project.
Dockerfile looks like this:
FROM centos:centos8
ENV SCALA_VERSION 2.13.1
ENV SBT_VERSION 1.5.2
RUN yum install -y epel-release
RUN yum update -y && yum install -y wget
# INSTALL JAVA
RUN yum install -y java-11-openjdk
# INSTALL SBT
RUN wget http://dl.bintray.com/sbt/rpm/sbt-${SBT_VERSION}.rpm
RUN yum install -y sbt-${SBT_VERSION}.rpm
RUN wget -O /usr/local/bin/sbt-launch.jar http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/$SBT_VERSION/sbt-launch.jar
WORKDIR /root
EXPOSE 8080
RUN sbt compile
CMD sbt run
But when I push anything, I get the following error:
The command '/bin/sh -c wget http://dl.bintray.com/sbt/rpm/sbt-${SBT_VERSION}.rpm' returned a non-zero code: 8
When I check the link manually (by setting the sbt version), I see indeed bintray responds with 403 forbidden error but status.bintray.com tells all systems are operational.
Am I doing something wrong or is something wrong with bintray?

Forbidden doesnt mean non operational.
I think that url is incorrect as its not hosted on bintray rather jfrog, please see section on Centos which states
remove old Bintray repo file
https://www.scala-sbt.org/1.x/docs/Installing-sbt-on-Linux.html

Related

How to build and install wal2json without also installing the package postgresql-server-dev on Debian 9?

I'm trying to stream data automatically from PostgreSQL 10 to Kafka using debezium together with the logical decoding plugin, wal2json.
I followed all the instructions on how to build and install the plugin from this link by running these command lines:
$ git clone https://github.com/eulerto/wal2json.git
$ cd wal2json
$ PATH=/usr/lib/postgresql/10/bin:$PATH
$ USE_PGXS=1 make
$ USE_PGXS=1 sudo make install
Yet, the steps for installation include this command line: USE_PGXS=1 make and it requires the installation of this package
sudo apt-get install postgresql-server-dev-10
else, I get the following error
Makefile:10: /usr/lib/postgresql/11/lib/pgxs/src/makefiles/pgxs.mk: No such file or directory
make: *** No rule to make target '/usr/lib/postgresql/11/lib/pgxs/src/makefiles/pgxs.mk'. Stop.
In fact, I am not allowed to install the package postgresql-server-dev-10 for personal reasons.
Thus, is there any way to install wal2json without installing that package or without using the command make?
Thank you.

Docker file for building code cloned from git

I've cloned a copy of FreeCAD from github and I'm trying to create a docker file so that I can develop it locally on my machine.
The objectives being that:
I have a local copy of the code from git on my machine
I can make modifications to the code
I can build debug and release image (do I need to create two separate images?)
Have access to the code on my machine, so that I can use git for source control
This is the content of my Dockerfile:
# Get base image
FROM phusion/baseimage
# Use baseimage-docker's init system.
CMD ["/sbin/my_init"]
# Get the build pre-requisites
RUN apt-get update
RUN apt-get install -y build-essential cmake python python-matplotlib libtool
RUN apt-get install -y libcoin80-dev libsoqt4-dev
RUN apt-get install -y libxerces-c-dev libboost-dev libboost-filesystem-dev
RUN apt-get install -y libboost-regex-dev
RUN apt-get install -y libboost-program-options-dev libboost-signals-dev
RUN apt-get install -y libboost-thread-dev libboost-python-dev libqt4-dev
RUN apt-get install -y libqt4-opengl-dev qt4-dev-tools python-dev
RUN apt-get install -y python-pyside pyside-tools
RUN apt-get install -y liboce*-dev oce-draw
RUN apt-get install -y libeigen3-dev libqtwebkit-dev libshiboken-dev
RUN apt-get install -y libpyside-dev libode-dev swig libzipios++-dev
RUN apt-get install -y libfreetype6 libfreetype6-dev
# to make Coin to support additional image file formats
RUN apt-get install -y libsimage-dev
# to register your installed files into your system's package manager, so yo can easily uninstall later
RUN apt-get install -y checkinstall
# needed for the 2D Drafting module
RUN apt-get install -y python-qt4 python-pivy
# doxygen and libcoin80-doc (if you intend to generate source code documentation)
RUN apt-get install -y doxygen libcoin80-doc
# libspnav-dev (for 3Dconnexion devices support like the Space Navigator or Space Pilot)
RUN apt-get install -y libspnav-dev
# CMAke related issue for compiling on Ubuntu Xenial: http://forum.freecadweb.org/viewtopic.php?f=4&t=16292
RUN apt-get install -y libmedc-dev
RUN apt-get install -y libvtk6-dev
RUN apt-get install -y libproj-dev
# Get git
RUN apt-get install -y git
RUN git clone https://github.com/FreeCAD/FreeCAD.git freecad
RUN cd freecad
RUN mkdir freecad-debug
RUN cd freecad-debug
# command below is just a diagnostic to let me know wth I am (output is: /)
# RUN pwd
RUN cmake ../ -DFREECAD_USE_EXTERNAL_PIVY=1 -DCMAKE_BUILD_TYPE=Debug .
#cmake -DFREECAD_USE_EXTERNAL_PIVY=1 -DCMAKE_BUILD_TYPE=Release .
RUN make
I attempt to build the image using the following command:
docker build -tag freeCAD-my-fork .
Everything works until I get to the first cmake invocation. I then get the following error:
CMake Error: The source directory "/" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
The command '/bin/sh -c cmake ../ -DFREECAD_USE_EXTERNAL_PIVY=1 -DCMAKE_BUILD_TYPE=Debug .' returned a non-zero code: 1
I placed a RUN pwd in my Dockerfile, so I could find where the cmake command was being run from, and I was surprised to find that it was been run from the root directory.
I thought the issue was being caused by my use of relative and that it would be fixed by absolute paths - however specifying /path/to/my/copy/freecad when cloning etc, the issue remains.
How can I write my Dockerfile so that it achieves the objectives outlined above (stated at the beginning of my question)?
Default WORKDIR in docker is "/".All docker commands will be executed in that directory.There are two option either you change WORKDIR(https://docs.docker.com/engine/reference/builder/#workdir) or execute everything in one layer(In one RUN command).I have taken second approach.
Cloning and Building source code both executed in One layer of docker.
RUN git clone https://github.com/FreeCAD/FreeCAD.git freecad \
&& cd freecad \
&& mkdir freecad-debug \
&& cd freecad-debug \
&& cmake ../ -DFREECAD_USE_EXTERNAL_PIVY=1 -DCMAKE_BUILD_TYPE=Debug . \
&& make
You should install all your dependencies using run as you do but the actual building and copying of source code files should not happen when you build your image but when you run a container.
This way you can reuse your image for as many builds as you like.
Write a script with the build commands and copy it over to your image. Then in the CMD part of the dockerfile run that script.
To share the git project with the container you can mount your local files with docker run -v hostpath:containerpath imagename. That way any files in hostpath will be visible to the container at containerpath and vice versa. Alternatively you could also git clone from the script which is invoked by CMD but then you have to expose the build somehow to your host (some mounted volume again).

Where is libpq-fe.h on a Travis-CI instance?

I'm trying to build a postgres database adapter (luapgsql) as part of my setup:
install:
- sudo luarocks install --server=http://rocks.moonscript.org/dev luapgsql
But the build can't find libpq-fe.h:
Error: Could not find expected file libpq-fe.h, or libpq-fe.h for PQ --
you may have to install PQ in your system and/or pass PQ_DIR or
PQ_INCDIR to the luarocks command. Example: luarocks install luapgsql
PQ_DIR=/usr/local
I've tried what's suggested above, apt-get install libpq-dev and just find \ -name libpq-fe.h. No luck so far. Any ideas where it might be?
So it turns out that running pg_config as part of the install: was the answer. I could read the output in the log.
In the end, the line that worked for me for installing luapgsql on travis is:
sudo luarocks install --server=http://rocks.moonscript.org/dev luapgsql PQ_INCDIR=/usr/include/postgresql PQ_LIBDIR=/usr/lib/x86_64-linux-gnu

Error "the PGXS Makefile cannot be found" when installing PostGis on Debian

I am in the process of installing PostGis over psql on a Debian machine (actually crunchbang).
I have completed the following steps:
$ wget http://download.osgeo.org/postgis/source/postgis-2.0.3.tar.gz
$ tar xzf postgis-2.0.3.tar.gz
$ cd postgis-2.0.3
$ ./configure
On the final step I get the following error:
configure: error: the PGXS Makefile /usr/lib/postgresql/9.1/lib/pgxs/src/makefiles/pgxs.mk cannot be found. Please install the PostgreSQL server development packages and re-run configure.
The issue is that I do already have Postgres installed:
$ psql --version
psql (9.1.9)
I have checked this on two machines with the same configuration and get the same error. What am I missing here?
PostgreSQL is broken down into several packages, and having psql installed doesn't imply that the development packages are also installed.
According to the error message:
Please install the PostgreSQL server development packages and re-run
configure
you need:
# apt-get install postgresql-server-dev-9.1
Also note there's a APT pgdg repository providing recent pre-compiled versions of postgres-related packages (including postgis) that you may use instead of self-compiling.
If your system is set up to use this repository, just do:
# apt-get install postgresql-9.1-postgis-2.0
Daniel's answer works great except that it needs the following update:
$ sudo apt-get install postgresql-9.1-postgis-2.1
These packages can be updated some time in future again. So, it is recommended to search for new packages using aptitude and install the appropriate one:
$ aptitude search postgis

Setting up Mesos on CentOS

I tried to install the latest release tarball of Mesos on CentOS 6.4 with no luck. It ended up in all sorts of failures in trying to find jvm & jni bindings. Is there any instructions on how to install Mesos on RHEL or CentOS ?
I couldn't find any instructions around so I thought I would troubleshoot all through my way and thought of documenting it here so it can save your time.
First things first, load your CentOS box with essential build tools to get started
$ sudo yum groupinstall "Development tools"
Get Java and python dependencies installed
$ sudo yum install java-1.6.0-openjdk.x86_64 java-1.6.0-openjdk-devel.x86_64 python python-devel libcurl libcurl-devel
Get the latest Mesos tarball
$ wget http://mirror.nus.edu.sg/apache/mesos/0.13.0/mesos-0.13.0.tar.gz
$ tar -xzvf mesos-0.13.0.tar.gz
$ cd mesos-0.13.0
Before you can build Mesos, you need to set correct JAVA binding paths
$ export JAVA_HOME=/usr
$ export JAVA_LDFLAGS="-L/usr/lib/jvm/java-1.6.0/jre/lib/amd64/server -R/usr/lib/jvm/java-1.6.0/jre/lib/amd64/server -ljvm"
$ export JAVA_CPPFLAGS="-I/usr/lib/jvm/java-1.6.0/include -I/usr/lib/jvm/java-1.6.0/include/linux"
$ export LD_LIBRARY_PATH=/usr/lib/jvm/java-1.6.0/jre/lib/amd64/server:$LD_LIBRARY_PATH
Configure and build it
$ ./configure
$ make
After you have built Mesos, it is advisable that you build and run the tests, this will make sure that what you have installed meets all the requirements
$ make check
If the checks are successful, You are just one step away from installing it in your system installation paths
$ make install
To learn how to use Mesos , go here http://mesos.apache.org/gettingstarted/
For those who prefer installing from RPM's, here is a link to a number of different releases for different Linux flavors: http://mesosphere.io/downloads/ For example, for Centos64:
wget http://downloads.mesosphere.io/master/centos/6/mesos_0.14.2_x86_64.rpm
sudo rpm -Uvh mesos_0.14.2_x86_64.rpm
I also had to set my LD_LIBRARY_PATH, though to a slightly different value. Check yours.
Python bindings can also be downloaded from the first link above:
wget http://downloads.mesosphere.io/master/centos/6/mesos_0.14.2_x86_64.egg
sudo easy_install mesos_0.14.2_x86_64.egg