Skip to content

Commit

Permalink
build: add dash minimal development environment container
Browse files Browse the repository at this point in the history
Co-authored-by: UdjinM6 <[email protected]>
  • Loading branch information
kwvg and UdjinM6 committed Dec 21, 2021
1 parent 2a28888 commit 9bedfa9
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 0 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
**
!contrib/containers/ci/Dockerfile
!contrib/containers/deploy/Dockerfile
!contrib/containers/develop/Dockerfile
1 change: 1 addition & 0 deletions contrib/containers/ci/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
32 changes: 32 additions & 0 deletions contrib/containers/develop/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
29 changes: 29 additions & 0 deletions contrib/containers/develop/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 9bedfa9

Please sign in to comment.