diff --git a/.dockerignore b/.dockerignore index a8f179e70d..ff58920f49 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,4 @@ ** !contrib/containers/ci/Dockerfile !contrib/containers/deploy/Dockerfile +!contrib/containers/develop/Dockerfile diff --git a/contrib/containers/ci/Dockerfile b/contrib/containers/ci/Dockerfile index 430d076649..6e240f67f8 100644 --- a/contrib/containers/ci/Dockerfile +++ b/contrib/containers/ci/Dockerfile @@ -69,6 +69,7 @@ RUN mkdir /dash-src && \ chown $USER_ID:$GROUP_ID /dash-src && \ chown $USER_ID:$GROUP_ID /cache && \ chown $USER_ID:$GROUP_ID /cache -R + WORKDIR /dash-src USER dash diff --git a/contrib/containers/develop/Dockerfile b/contrib/containers/develop/Dockerfile new file mode 100644 index 0000000000..7ad971a30d --- /dev/null +++ b/contrib/containers/develop/Dockerfile @@ -0,0 +1,32 @@ +# syntax = edrevo/dockerfile-plus + +FROM ubuntu:focal + +INCLUDE+ ci/Dockerfile + +# The inherited Dockerfile switches to non-privileged context and we've +# just started configuring this image, give us root access +USER root + +# Discourage root access, this is an interactive instance +# +# Sometimes these commands are run repetitively _after_ the non-sudo +# user was introduced and therefore these commands would fail +# To mitigate the build halting, we've added "|| true" so that it +# unconditionally returns 0 +# +RUN apt-get update && apt-get install $APT_ARGS sudo && rm -rf /var/lib/apt/lists/* +RUN usermod -aG sudo dash +RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers + +# Make development environment more standalone +RUN apt-get update && apt-get install $APT_ARGS nano openssh-client zsh gdb && rm -rf /var/lib/apt/lists/* + +# Disable noninteractive mode +ENV DEBIAN_FRONTEND="dialog" + +# Expose Dash P2P and RPC ports for main network and test networks +EXPOSE 9998 9999 19998 19999 + +# We're done, switch back to non-privileged user +USER dash diff --git a/contrib/containers/develop/docker-compose.yml b/contrib/containers/develop/docker-compose.yml new file mode 100644 index 0000000000..ec2a343ea8 --- /dev/null +++ b/contrib/containers/develop/docker-compose.yml @@ -0,0 +1,29 @@ +version: "3.9" +services: + container: + entrypoint: /bin/bash + build: + context: '..' + dockerfile: './develop/Dockerfile' + tty: true # Equivalent to -t + stdin_open: true # Equivalent to -i + ports: + - "9998:9998" # Mainnet Ports + - "9999:9999" + - "19998:19998" # Testnet Ports + - "19999:19999" + +# A note about volumes: +# +# If Docker is interacting with your operating system directly +# without an intermediate VM, then you do not need to change anything +# +# But if not, then you'll need to mount your system's root directory +# (i.e. /) into the boot2docker instance if you want to mirror the exact +# filesystem structure of your host. +# + volumes: + - type: bind +# source: /host/$PWD # Workaround needed on non-Linux hosts + source: ../../.. + target: /dash-src