Skip to content
Snippets Groups Projects
Commit 2568f691 authored by Jakob Olsson's avatar Jakob Olsson
Browse files

add docker image for development

parent 44b32937
No related branches found
No related tags found
No related merge requests found
FROM ubuntu:16.04
LABEL maintainer="jakob.olsson@iopsys.eu"
LABEL build="docker build -t iopsys/json-editor ."
LABEL run="docker run -d --name json-editor --privileged --rm -v ${PWD}:/opt/work -p 12345:22 -e LOCAL_USER_ID=`id -u $USER` iopsys/json-editor:latest"
LABEL exec="docker exec --user=user -it json-editor bash"
LABEL stop="docker stop json-editor"
RUN \
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
# general tools
git \
cmake \
wget \
build-essential \
lcov \
apt-utils \
autoconf \
automake \
pkg-config \
libtool \
vim \
valgrind \
gdb \
cppcheck \
python3 \
python3-setuptools \
openssh-server \
clang-format \
sudo \
strace \
supervisor \
net-tools \
iputils-ping
# Configure OpenSSH server
RUN mkdir /var/run/sshd
RUN echo 'root:root' | chpasswd
RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN sed -i 's/PermitEmptyPasswords no/PermitEmptyPasswords yes/' /etc/ssh/sshd_config
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
# Configure gdb-dashboard
RUN \
easy_install3 pip && \
pip3 install Pygments
RUN wget -P ~ git.io/.gdbinit
RUN \
mkdir ~/.gdbinit.d && \
touch ~/.gdbinit.d/init && \
echo "dashboard -layout source" >> ~/.gdbinit.d/init && \
echo "dashboard source -style context 20" >> ~/.gdbinit.d/init && \
echo "dashboard -style syntax_highlighting 'monokai'" >> ~/.gdbinit.d/init
# Install dependent libraries
RUN \
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
lua5.1-dev \
lua5.1 \
#libjson0 \
#libjson0-dev \
libssl-dev \
libuv1-dev \
cmocka-doc \
libcmocka-dev \
libcmocka0
# Install CMocka
#RUN \
# git clone --branch cmocka-1.1.1 git://git.cryptomilk.org/projects/cmocka.git && \
# cd cmocka && \
# mkdir build && \
# cd build && \
# cmake .. && \
# make && \
# make install
# Remove cached packages.
RUN rm -rf /var/lib/apt/lists/*
RUN mkdir /opt/dev
# Install JSON-C
RUN \
cd /opt/dev && \
git clone https://github.com/json-c/json-c.git && \
cd json-c && \
sh autogen.sh && \
./configure && \
make && \
make install && \
sudo ldconfig
# ubox
RUN \
cd /opt/dev && \
git clone git://git.openwrt.org/project/libubox.git && \
cd libubox && mkdir build && cd build && \
git checkout fd57eea9f37e447814afbf934db626288aac23c4 && \
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE:String="Release" .. && \
make -j2 && \
make install
RUN mkdir /etc/config
WORKDIR /opt/work
# Expose ports
EXPOSE 22
# Prepare supervisor
RUN mkdir -p /var/log/supervisor
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# Start entrypoint
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
#!/bin/bash
# Create user
USER_ID=${LOCAL_USER_ID:-9001}
useradd --shell /bin/bash -u $USER_ID -G sudo -o -c "" -m user
adduser --disabled-password user
export HOME=/home/user
echo "user ALL = NOPASSWD : ALL" >> /etc/sudoers
# Configure OpenSSH to allow login without password
sed -i -re 's/^user:[^:]+:/user::/' /etc/passwd /etc/shadow
pam_config="auth [success=1 default=ignore] pam_unix.so nullok\nauth requisite pam_deny.so\nauth required pam_permit.so"
sed -i "s/@include common-auth/$pam_config/" /etc/pam.d/sshd
# Start supervisor
/usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf -l /var/log/supervisord.log -j /var/run/supervisord.pid
[supervisord]
nodaemon=true
[program:ubusd]
command=/bin/bash -c "/usr/sbin/ubusd"
[program:rpcd]
command=/bin/bash -c "/usr/sbin/rpcd"
[program:sshd]
command=/usr/sbin/sshd -D
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment