Created
January 3, 2019 09:42
-
-
Save motephyr/1962517a4f93fdf16dba34c3ad0018cd to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| FROM ubuntu:16.04 | |
| # Avoid error messages from apt during image build | |
| ARG DEBIAN_FRONTEND=noninteractive | |
| RUN \ | |
| apt-get update && \ | |
| apt-get install -y wget curl gnupg | |
| RUN \ | |
| wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb && \ | |
| dpkg -i erlang-solutions_1.0_all.deb && \ | |
| apt-get update && \ | |
| apt-get install -y esl-erlang elixir build-essential openssh-server git locales | |
| RUN \ | |
| apt-get update && \ | |
| curl -sL https://deb.nodesource.com/setup_8.x | bash - && \ | |
| apt-get install -y nodejs | |
| # Elixir requires UTF-8 | |
| RUN locale-gen en_US.UTF-8 | |
| ENV LANG en_US.UTF-8 | |
| ENV LANGUAGE en_US:en | |
| ENV LC_ALL en_US.UTF-8 | |
| RUN update-locale LANG=$LANG | |
| RUN mkdir /var/run/sshd | |
| # Create motephyr user | |
| RUN useradd --system --shell=/bin/bash --create-home xxx | |
| #config motephyr user for public key authentication | |
| RUN mkdir /home/xxx/.ssh/ && chmod 700 /home/xxx/.ssh/ | |
| COPY ./config/ssh_key.pub /home/xxx/.ssh/authorized_keys | |
| RUN chown -R xxx /home/xxx/ | |
| RUN chgrp -R xxx /home/xxx/ | |
| RUN chmod 700 /home/xxx/.ssh/ | |
| RUN chmod 644 /home/xxx/.ssh/authorized_keys | |
| RUN mix local.hex | |
| RUN mix local.rebar | |
| #Configure public keys for sshd | |
| RUN echo "AuthorizedKeysFile %h/.ssh/authorized_keys" >> /etc/ssh/sshd_config | |
| RUN mkdir -p /home/xxx/xxxx/config | |
| ================ | |
| copy your secret file | |
| COPY config/prod.secret.exs /home/xxx/xxxx/prod.secret.exs | |
| COPY config/staging.secret.exs /home/xxx/xxxx/staging.secret.exs | |
| ==== | |
| EXPOSE 22 | |
| CMD ["/usr/sbin/sshd", "-D"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment