-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from cscenter/master
postgresql docker image
- Loading branch information
Showing
4 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
FROM ubuntu:14.04 | ||
MAINTAINER Pavel Sviderski <[email protected]> | ||
|
||
RUN apt-get update && apt-get --no-install-recommends -y install \ | ||
man openssh-server wget python-pip \ | ||
vim nano screen tmux \ | ||
binutils build-essential gdb ltrace strace \ | ||
sqlite sqlite3 \ | ||
postgresql postgresql-client \ | ||
&& apt-get clean \ | ||
&& useradd -m box | ||
|
||
RUN sed -i 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config \ | ||
&& sed -i 's/#UsePAM no/UsePAM no/g' /etc/ssh/sshd_config \ | ||
&& echo "box ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/box | ||
|
||
COPY common/ssh /root/.ssh | ||
COPY common/bashrc /root/.bashrc | ||
|
||
COPY challenge-dbms/start.sh /.box/start.sh | ||
COPY challenge-dbms/init-postgresql.sh /.box/init-postgresql.sh | ||
COPY challenge-dbms/bashrc /home/box/.bashrc | ||
|
||
COPY common/greeting /.box/greeting | ||
|
||
EXPOSE 22 | ||
|
||
CMD /.box/start.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
PS1='\[\033[01;32m\]\u\[\033[01;33m\]@\[\033[01;32m\]\h: \[\033[01;33m\]\w \[\033[01;35m\]\$ \[\033[00m\]' | ||
alias ls="ls --color=auto" | ||
export PGPASSWORD="box" | ||
alias psql="psql -h localhost" | ||
|
||
cd ~/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
# This script was copied from PostgreSQL Docker image. | ||
# Original sources: https://github.com/docker-library/postgres/blob/ed23320582f4ec5b0e5e35c99d98966dacbc6ed8/9.4/docker-entrypoint.sh | ||
sudo service postgresql start | ||
export POSTGRES_PASSWORD="box" | ||
export POSTGRES_USER="box" | ||
|
||
sudo -u postgres psql -c "CREATE USER ${POSTGRES_USER} WITH PASSWORD '${POSTGRES_PASSWORD}' SUPERUSER;" | ||
export PGPASSWORD="${POSTGRES_PASSWORD}" | ||
createdb -h localhost -U $POSTGRES_USER $POSTGRES_USER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
|
||
/sbin/my_init --skip-startup-files &>/dev/null & | ||
echo "Initializing PostgreSQL..." | ||
/.box/init-postgresql.sh | ||
echo "...done. Type psql to start the PostgreSQL shell" | ||
|
||
echo "Press ENTER to start hacking..." | ||
trap '' 2 # mock SIGINT on CTRL+C | ||
read | ||
trap 2 # enable SIGINT | ||
|
||
cat /.box/greeting | ||
while true; do | ||
su box | ||
done |