Skip to content

Commit 418dbd7

Browse files
3 WIP: Working on creating docker environment
1 parent 3e7acb8 commit 418dbd7

File tree

5 files changed

+65
-0
lines changed

5 files changed

+65
-0
lines changed

Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM ubuntu:16.04
2+
3+
RUN mkdir -p /_build/
4+
WORKDIR /_build/
5+
ADD . /_build/
6+
7+
RUN apt-get update
8+
9+
RUN apt-get install -y \
10+
sudo \
11+
build-essential \
12+
python3-dev \
13+
python3-pip \
14+
openssh-server
15+
16+
RUN make create_user
17+
18+
RUN mkdir /var/run/sshd
19+
20+
RUN rm -Rf /_build/

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
SHELL := /bin/bash
2+
3+
4+
create_user:
5+
source scripts/build/create_user.sh

compose/base.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: '2'
2+
3+
services:
4+
app:
5+
restart: always
6+
build:
7+
context: ../
8+
image: application
9+
volumes:
10+
- ../:/srv/src/app
11+
container_name: application
12+
working_dir: "/srv/src/app"
13+
command: scripts/docker_startup.sh

scripts/build/create_user.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!bin/bash
2+
SUDO_USER=happy
3+
SUDO_PASS=happy@1234
4+
APP_USER=caffeine
5+
APP_HOME=/srv/src
6+
7+
echo "==> Creating sudo user '$SUDO_USER'"
8+
sudo useradd \
9+
--user-group \
10+
--no-create-home \
11+
--shell /bin/bash \
12+
$SUDO_USER
13+
echo $SUDO_USER:$SUDO_PASS | sudo chpasswd
14+
sudo adduser $SUDO_USER sudo
15+
echo "$SUDO_USER ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/90-$SUDO_USER
16+
17+
echo "==> Creating app user '$APP_USER'"
18+
sudo mkdir -p $APP_HOME
19+
sudo useradd \
20+
--shell /bin/bash \
21+
--user-group \
22+
--home-dir $APP_HOME \
23+
$APP_USER
24+
sudo chown $APP_USER: $APP_HOME

scripts/docker_startup.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
/usr/sbin/sshd -D

0 commit comments

Comments
 (0)