build: add dash minimal development environment container

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
This commit is contained in:
Kittywhiskers Van Gogh 2021-12-16 19:44:41 +05:30
parent 2a28888daf
commit 9bedfa9838
4 changed files with 63 additions and 0 deletions

View File

@ -1,3 +1,4 @@
** **
!contrib/containers/ci/Dockerfile !contrib/containers/ci/Dockerfile
!contrib/containers/deploy/Dockerfile !contrib/containers/deploy/Dockerfile
!contrib/containers/develop/Dockerfile

View File

@ -69,6 +69,7 @@ RUN mkdir /dash-src && \
chown $USER_ID:$GROUP_ID /dash-src && \ chown $USER_ID:$GROUP_ID /dash-src && \
chown $USER_ID:$GROUP_ID /cache && \ chown $USER_ID:$GROUP_ID /cache && \
chown $USER_ID:$GROUP_ID /cache -R chown $USER_ID:$GROUP_ID /cache -R
WORKDIR /dash-src WORKDIR /dash-src
USER dash USER dash

View File

@ -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

View File

@ -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