Skip to content

Commit

Permalink
added init script to dockerfile...
Browse files Browse the repository at this point in the history
  • Loading branch information
marklee77 committed Nov 3, 2014
1 parent 517fa09 commit 908e81f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 26 deletions.
28 changes: 26 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
FROM phusion/baseimage:latest
MAINTAINER Mark Stillwell <[email protected]>

COPY scripts/setkey.sh /etc/my_init.d/05-setkey
RUN chmod 755 /etc/my_init.d/05-setkey
RUN mkdir -p /etc/my_init.d && \
> /etc/my_init.d/05-setkey echo '#!/bin/bash\n\
ATTEMPTS=30\n\
\n\
mkdir -p /root/.ssh\n\
chmod 700 /root/.ssh\n\
\n\
TMPFILE=$(mktemp)\n\
while [ ! -f /root/.ssh/authorized_keys ] && [ ${ATTEMPTS} -gt 0 ]; do\n\
ATTEMPTS=$((${ATTEMPTS}-1))\n\
curl -s http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key\\\n\
> ${TMPFILE} 2>/dev/null\n\
if [ $? -eq 0 ]; then\n\
cat ${TMPFILE} >> /root/.ssh/authorized_keys\n\
chmod 0600 /root/.ssh/authorized_keys\n\
echo "Successfully retrieved public key from instance metadata"\n\
echo "********************************************************"\n\
echo "AUTHORIZED KEYS"\n\
echo "********************************************************"\n\
cat /root/.ssh/authorized_keys\n\
echo\n\
echo "********************************************************"\n\
fi\n\
done\n\
rm -f ${TMPFILE}\n' && \
chmod 755 /etc/my_init.d/05-setkey
File renamed without changes.
24 changes: 0 additions & 24 deletions scripts/setkey.sh

This file was deleted.

0 comments on commit 908e81f

Please sign in to comment.