Skip to content

Instantly share code, notes, and snippets.

@ohoachuck
Created January 7, 2018 18:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ohoachuck/d6c3c24a727c73a06cfb12eef4b9049a to your computer and use it in GitHub Desktop.
Save ohoachuck/d6c3c24a727c73a06cfb12eef4b9049a to your computer and use it in GitHub Desktop.
############################################################
# Dockerfile to build program-y Application Containers
# Based on centos and python 3.6
############################################################
# Set the base image to centos
FROM centos
# File Author / Maintainer
MAINTAINER Olivier HO-A-CHUCK
# Update the sources list
RUN yum update -y
# Install basic applications
RUN yum install -y tar git curl nano wget dialog net-tools yum-utils
# Install Python and Basic Python Tools
RUN yum install -y https://centos7.iuscommunity.org/ius-release.rpm
RUN yum install -y python36u python36u-pip python36u-devel
# link python3.6 to python3
RUN ln -s /usr/bin/python3.6 /usr/bin/python3
# create program-y user with password=program-y
RUN useradd -m -p program-y program-y
# get program-y repo source as "program-y" user (could be your own repo with you own bot implementation)
RUN su -c 'git clone https://github.com/keiffster/program-y.git /home/program-y/program-y' - program-y
# Get pip to download and install requirements:
RUN pip3.6 install -r /home/program-y/program-y/requirements.txt
# Expose ports for flask API
EXPOSE 5000
# Copy the launch script inside the container
# launch.sh is : su -c 'cd /home/program-y/program-y/bots/y-bot/ && /home/program-y/program-y/bots/y-bot/y-bot-flask-rest.sh' - program-y
ADD /launch.sh /home/program-y/program-y/bots/y-bot/launch.sh
# Set the default directory where CMD will execute
WORKDIR /home/program-y/program-y/bots/y-bot/
# Set the default command to execute
# when creating a new container
# Launch y-bot-flask-rest.sh as user "program-y"
# In unix (Linux, Mac OS X, BSD etc) systems, ports less than 1024 can not be bound to by normal users,
# only the root user can bind to those ports. So script like y-bot-webchat.sh would not be usable by
# user program-y unless default port 80 is changes to 8080 for instance
CMD /bin/bash ./launch.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment