Skip to content

Instantly share code, notes, and snippets.

@hangingman
Created December 6, 2017 09:11
Show Gist options
  • Save hangingman/cf7f1867891502e3d0d998f921b1e582 to your computer and use it in GitHub Desktop.
Save hangingman/cf7f1867891502e3d0d998f921b1e582 to your computer and use it in GitHub Desktop.
Airflow使いたい
FROM amazonlinux
# set yum repository mirror for jp
RUN yum -y install yum-plugin-fastestmirror
RUN sed -ri 's/#include_only=.nl,.de,.uk,.ie/include_only=.jp/g' /etc/yum/pluginconf.d/fastestmirror.conf
# install packages
RUN yum -y update
RUN yum -y install vim
RUN yum -y install passwd openssh openssh-server openssh-clients sudo iproute
# create users
RUN useradd ec2-user
RUN passwd -f -u ec2-user
# setup sudoers
RUN echo "ec2-user ALL=(ALL) ALL" >> /etc/sudoers.d/ec2-user
# setup SSH
RUN mkdir -p /home/ec2-user/.ssh; chown ec2-user /home/ec2-user/.ssh; chmod 700 /home/ec2-user/.ssh
#ADD authorized_keys /home/ec2-user/.ssh/authorized_keys
#RUN chown ec2-user /home/ec2-user/.ssh/authorized_keys
#RUN chmod 600 /home/ec2-user/.ssh/authorized_keys
# setup sshd config
RUN sed -ri 's/#PermitRootLogin yes/PermitRootLogin yes/g' /etc/ssh/sshd_config
RUN sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config
RUN sed -ri 's/#UsePAM no/UsePAM no/g' /etc/ssh/sshd_config
RUN /etc/init.d/sshd start
# install MySQL client
RUN yum install -y mysql
# install Python3
RUN yum install -y python35 python35-devel python35-libs python35-setuptools
RUN easy_install-3.5 pip
# install gcc & devel files
RUN yum install -y gcc mysql-devel
RUN pip install airflow[mysql]
EXPOSE 22
CMD ["/sbin/init"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment