Skip to content

Commit

Permalink
more refinement of dockerfile & added stack needs
Browse files Browse the repository at this point in the history
  • Loading branch information
dysinger committed Mar 31, 2016
1 parent 0bf0eed commit 9046008
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions etc/docker/ubuntu-with-gnupg/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,36 +1,44 @@
FROM fpco/ubuntu-with-libgmp:14.04

# INSTALL PACKAGES
# PACKAGES
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update
RUN apt-get -y install curl expect
RUN apt-get -y install curl ;# needed to install Nix
RUN apt-get -y install expect ;# needed to automate GPG key trust
RUN apt-get -y install build-essential ;# needed by Stack at runtime
RUN apt-get -y install libgmp-dev ;# needed by Stack at runtime
RUN apt-get -y install xz-utils ;# needed by Stack at runtime

# CREATE USER
# USER
ENV USER user
ENV HOME /home/$USER
RUN groupadd -r nixbld
RUN useradd -m $USER -G nixbld
RUN useradd -m $USER

# GPG CONFIG & KEYS
ADD .gnupg/ $HOME/.gnupg/
RUN chown -R user:user $HOME
RUN chown -R $USER:$USER $HOME
RUN chmod -R go-rwsx $HOME

# NIX DIR & GROUP
RUN mkdir /nix
RUN chown $USER:nixbld /nix
WORKDIR $HOME
USER $USER
RUN chown -R $USER:$USER /nix
RUN groupadd -r nixbld

# INSTALL NIX
CMD /bin/bash -l
WORKDIR $HOME
USER $USER
RUN curl -s https://nixos.org/nix/install | sh
RUN echo "\nsource /nix/var/nix/profiles/default/etc/profile.d/nix.sh" \
| tee -a $HOME/.bash_profile

# INSTALL GNUPGS & SETUP KEYS
# GNUPG PROFILES
RUN bash -lc "nix-env -p /nix/var/nix/profiles/gpg14 -iA nixpkgs.nix nixpkgs.gnupg1orig"
RUN bash -lc "nix-env -p /nix/var/nix/profiles/gpg20 -iA nixpkgs.nix nixpkgs.gnupg20"
RUN bash -lc "nix-env -p /nix/var/nix/profiles/gpg21 -iA nixpkgs.nix nixpkgs.gnupg"
RUN bash -lc "nix-env -S /nix/var/nix/profiles/gpg14" ;# SET CURRENT PROFILE TO GPG 1.4

# IMPORT & TRUST KEYS
RUN bash -lc "gpg --import $HOME/.gnupg/public.asc $HOME/.gnupg/subkey.asc"
RUN bash -lc "expect $HOME/.gnupg/trust"
RUN rm $HOME/.gnupg/*.asc $HOME/.gnupg/trust

# LOGIN SHELL
CMD /bin/bash -l

0 comments on commit 9046008

Please sign in to comment.