Skip to content

Instantly share code, notes, and snippets.

@jbolila
Created August 16, 2016 21:14
Show Gist options
  • Save jbolila/9e52aa08d7637ce355dceed6edab2035 to your computer and use it in GitHub Desktop.
Save jbolila/9e52aa08d7637ce355dceed6edab2035 to your computer and use it in GitHub Desktop.
Postgres latest (9.5) with Rust ready to Diesel_CLI
FROM postgres:latest
MAINTAINER Joao Bolila
ENV LC_ALL=C.UTF-8
RUN apt-get update
RUN apt-get -y install vim silversearcher-ag jq
RUN apt-get -y install build-essential git libsqlite3-dev libpq-dev
RUN cd /tmp ; git clone git://github.com/rkitover/vimpager ; cd vimpager ; make install-deb
RUN printf "\n\nPAGER=/usr/bin/vimpager\nexport PAGER\nalias less=$PAGER\nalias zless=$PAGER" >> /etc/profile
RUN printf "\n\nMANPAGER=/usr/bin/vimpager\nexport MANPAGER" >> /etc/profile
ENV TERM="xterm-256color"
RUN echo $"\n\
set encoding=utf-8 nobomb\n\
scriptencoding utf-8\n\
if &compatible | set nocompatible | endif\n\
if empty(glob('~/.vim/autoload/plug.vim'))\n\
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs\n\
\\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim\n\
autocmd VimEnter * PlugInstall | source $MYVIMRC\n\
endif\n\
call plug#begin('~/.vim/bundle')\n\
Plug 'vim-scripts/dbext.vim'\n\
call plug#end()\n\
filetype plugin indent on\n\
syntax enable\n\
set t_Co=256\n"\
> ~/.vimrc
RUN vim +PlugInstall +qall
# dbext ties into Vim dictionary feature. You can complete table names, procedure names and view names using the i_CTRL-X_CTRL-K feature
RUN echo "local:5432:postgres:postgres:postgres" > ~/.pgpass
RUN chmod 0600 ~/.pgpass
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
RUN echo 'source $HOME/.cargo/env' >> ~/.bashrc
@jbolila
Copy link
Author

jbolila commented Aug 16, 2016

build:

docker build --force-rm --no-cache -t pg_with_my_stuff .

start:

docker run -d -v $(pwd):/src --name my_postgres -e LC_ALL=C.UTF-8 -p 5432:5432 pg_with_my_stuff

bash:

docker exec -it my_postgres bash
psql -h 127.0.0.1 -U postgres postgres

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment