Skip to content

Instantly share code, notes, and snippets.

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 rreece/9eb4b959da7dbaef9cd406777bf95d53 to your computer and use it in GitHub Desktop.
Save rreece/9eb4b959da7dbaef9cd406777bf95d53 to your computer and use it in GitHub Desktop.
Dockerfile based on centos:7 Python3.6 and pipenv
# Use an official centos7 image
FROM centos:7
RUN localedef -i fr_FR -c -f UTF-8 -A /usr/share/locale/locale.alias fr_FR.UTF-8
ENV LANG fr_FR.utf8
# gcc because we need regex and pyldap
# openldap-devel because we need pyldap
RUN yum update -y \
&& yum install -y https://centos7.iuscommunity.org/ius-release.rpm \
&& yum install -y python36u python36u-libs python36u-devel python36u-pip \
&& yum install -y which gcc \
&& yum install -y openldap-devel
# pipenv installation
RUN pip3.6 install pipenv
RUN ln -s /usr/bin/pip3.6 /bin/pip
RUN rm /usr/bin/python
# python must be pointing to python3.6
RUN ln -s /usr/bin/python3.6 /usr/bin/python
WORKDIR /opt/intranet
# pipenv install django --python `which python3.6` --system
# pipenv install --python `which python3.6` --system
# copy the Pipfile to the working directory
COPY Pipfile /opt/intranet/
# This is useful for Docker containers, and deployment infrastructure (e.g. Heroku does this)
# explicit is better than implicit
RUN pipenv install --python `which python3.6` --system
@rreece
Copy link
Author

rreece commented Feb 21, 2019

## List Docker CLI commands
docker
docker container --help

## Display Docker version and info
docker --version
docker version
docker info

## Execute Docker image
docker run hello-world

## List Docker images
docker image ls

## List Docker containers (running, all, all in quiet mode)
docker container ls
docker container ls --all
docker container ls -aq

## build image
docker build -t <imagetag:0.1> .

## start container and go into bash
docker run -it <imagetag:0.1> bash

https://docs.docker.com/get-started/

@rreece
Copy link
Author

rreece commented Feb 21, 2019

#
# Copyright 2018 Cerebras Systems, Inc. All rights reserved.
#
# InputPipe Container
#
# This composes the layer above the base container that includes sources
# and binaries.
#
#------------------------------------------------------------------------------


# Base layer from centos
FROM docker.io/centos:7

# install EPEL and basics
RUN yum update -y \
        && yum install -y https://centos7.iuscommunity.org/ius-release.rpm \
        && yum install -y python36u python36u-libs python36u-devel python36u-pip \
        && yum install -y which gcc \ 
        && yum install -y openldap-devel \
        && yum install -y git

# pipenv installation
RUN pip3.6 install pipenv
RUN ln -s /usr/bin/pip3.6 /usr/bin/pip3
RUN ln -s /usr/bin/python3.6 /usr/bin/python3
RUN pip3 install --upgrade pip

# install our package
COPY ./ /opt/inputpipe

# install missing packages
RUN pip3 install -r /opt/inputpipe/requirements.txt

# Set PYTHONPATH
#ENV PYTHONPATH /opt/inputpipe/python:${PYTHONPATH}
#ENV PYTHONPATH /opt/inputpipe/models:${PYTHONPATH}

# Set PATH
ENV PATH /opt/inputpipe/scripts:${PATH}

# Set LD_LIBRARY_PATH

# Set WORKDIR
WORKDIR /root

# Run bash by default
CMD ["/bin/bash"]

https://github.com/Cerebras/ANL-shared/blob/rreece/branch2/Dockerfile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment