Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions 20 Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM ubuntu:16.04

RUN mkdir -p /_build/
WORKDIR /_build/
ADD . /_build/

RUN apt-get update

RUN apt-get install -y \
sudo \
build-essential \
python3-dev \
python3-pip \
openssh-server

RUN make create_user

RUN mkdir /var/run/sshd

RUN rm -Rf /_build/
5 changes: 5 additions & 0 deletions 5 Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
SHELL := /bin/bash


create_user:
source scripts/build/create_user.sh
14 changes: 14 additions & 0 deletions 14 README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#PythonPH

## Prerequisites
* Docker
* Docker Compose
* Git

## Spinning a docker container
```bash
$ docker-compose -f compose/development.yml run -d --rm --name <name> --service-ports app
```
###### Notes:
* Change `name` into what you want to call your container.
* Update `development.yml` if there's conflicting with the ports.
13 changes: 13 additions & 0 deletions 13 compose/base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: '2'

services:
app:
restart: always
build:
context: ../
image: application
volumes:
- ../:/srv/src/app
container_name: application
working_dir: "/srv/src/app"
command: scripts/docker_startup.sh
11 changes: 11 additions & 0 deletions 11 compose/development.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: '2'

services:
app:
extends:
file: base.yml
service: app
container_name: development_app
ports:
- "8080:8000"
- "2323:22"
24 changes: 24 additions & 0 deletions 24 scripts/build/create_user.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!bin/bash
SUDO_USER=happy
SUDO_PASS=happy@1234
APP_USER=caffeine
APP_HOME=/srv/src

echo "==> Creating sudo user '$SUDO_USER'"
sudo useradd \
--user-group \
--no-create-home \
--shell /bin/bash \
$SUDO_USER
echo $SUDO_USER:$SUDO_PASS | sudo chpasswd
sudo adduser $SUDO_USER sudo
echo "$SUDO_USER ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/90-$SUDO_USER

echo "==> Creating app user '$APP_USER'"
sudo mkdir -p $APP_HOME
sudo useradd \
--shell /bin/bash \
--user-group \
--home-dir $APP_HOME \
$APP_USER
sudo chown $APP_USER: $APP_HOME
3 changes: 3 additions & 0 deletions 3 scripts/docker_startup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

/usr/sbin/sshd -D
Morty Proxy This is a proxified and sanitized view of the page, visit original site.