-1
FROM ubuntu:14.04

RUN apt-get update
RUN apt-get install -y build-essential git
RUN apt-get install -y python python-dev python3 python3-dev python3-pip
RUN apt-get install -y nginx uwsgi uwsgi-plugin-python3 supervisor

RUN pip3 install uwsgi

#RUN echo "\ndaemon off;" >> /etc/nginx/nginx.conf
RUN chown -R www-data:www-data /var/lib/nginx

# UWSGI
ENV UWSGIVERSION 2.0.11.2

RUN apt-get update && apt-get install -y --no-install-recommends \
            build-essential \
            libjansson-dev \
            libpcre3-dev \
            libssl-dev \
            libxml2-dev \
            wget \
            zlib1g-dev

RUN cd /usr/src && \
    wget --quiet -O - http://projects.unbit.it/downloads/uwsgi-${UWSGIVERSION}.tar.gz | \
    tar zxvf -

RUN cd /usr/src/uwsgi-${UWSGIVERSION} && make
RUN cp /usr/src/uwsgi-${UWSGIVERSION}/uwsgi /usr/local/bin/uwsgi
RUN PYTHON=/usr/local/python3.4/bin/python3.4
RUN cd /usr/src/uwsgi-${UWSGIVERSION} && ./uwsgi --build-plugin "plugins/python python34"
RUN mkdir -p /usr/local/lib/uwsgi/plugins
RUN cp /usr/src/uwsgi-${UWSGIVERSION}/*.so /usr/local/lib/uwsgi/plugins

# Java
ENV VERSION 7
ENV UPDATE 80
ENV BUILD 15

ENV JAVA_HOME /usr/lib/jvm/java-${VERSION}-oracle
ENV JRE_HOME ${JAVA_HOME}/jre

RUN apt-get update && apt-get install ca-certificates curl -y && \
    curl --silent --location --retry 3 --cacert /etc/ssl/certs/GeoTrust_Global_CA.pem \
    --header "Cookie: oraclelicense=accept-securebackup-cookie;" \
    http://download.oracle.com/otn-pub/java/jdk/"${VERSION}"u"${UPDATE}"-b"${BUILD}"/server-jre-"${VERSION}"u"${UPDATE}"-linux-x64.tar.gz \
    | tar xz -C /tmp && \
    mkdir -p /usr/lib/jvm && mv /tmp/jdk1.${VERSION}.0_${UPDATE} "${JAVA_HOME}" && \
    apt-get autoclean && apt-get --purge -y autoremove && \
    rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN update-alternatives --install "/usr/bin/java" "java" "${JRE_HOME}/bin/java" 1 && \
    update-alternatives --install "/usr/bin/javac" "javac" "${JAVA_HOME}/bin/javac" 1 && \
    update-alternatives --set java "${JRE_HOME}/bin/java" && \
    update-alternatives --set javac "${JAVA_HOME}/bin/javac"

# Node
RUN \
  apt-get update && \
  apt-get install -yqq curl \
  wget git python build-essential g++ libkrb5-dev libfreetype6 libfontconfig \
  libjpeg8 libpng12-0 libicu-dev libcurl3 libcurl3-gnutls libcurl4-openssl-dev \
  libcurl3 libcurl3-gnutls libcurl4-openssl-dev && \
  curl --silent --location https://deb.nodesource.com/setup_0.10 | bash - && \
  apt-get install -yqq nodejs && \
  wget -O - 'https://s3.amazonaws.com/travis-phantomjs/phantomjs-2.0.0-ubuntu-14.04.tar.bz2' | tar xjf - -C ~/ && \
  mv ~/phantomjs /usr/local/bin/ && \
  npm install -g npm@2.7.5 && \
  apt-get autoremove -yqq && \
  apt-get clean
RUN npm install -g bower

# Redis
RUN apt-get update -qq && apt-get install -y python-software-properties sudo
RUN apt-get install -y redis-server
RUN chown -R redis:redis /var/lib/redis

# psycopg2
RUN apt-get install -y python-psycopg2
RUN apt-get install -y libpq-dev

# lxml
RUN apt-get install -y python3-lxml
RUN apt-get install -y libxml2-dev libxslt-dev

# Pillow
RUN apt-get install -y libjpeg8 libjpeg62-dev libfreetype6 libfreetype6-dev

# Project
ENV PROJECT_DIR /home/ubuntu/workspace/ward
ADD . ${PROJECT_DIR}
RUN cd ${PROJECT_DIR} && bower --allow-root install
RUN cd ${PROJECT_DIR} && pip3 install -r requirements.txt
RUN mkdir ${PROJECT_DIR}/www/logs
RUN cd ${PROJECT_DIR}/www && python3 manage.py migrate --noinput
RUN cd ${PROJECT_DIR}/www && python3 manage.py collectstatic --noinput

RUN ln -s ${PROJECT_DIR}/conf/nginx-app.conf /etc/nginx/sites-enabled/
RUN ln -s ${PROJECT_DIR}/conf/uwsgi.ini /etc/uwsgi/apps-enabled/
RUN ln -s ${PROJECT_DIR}/conf/celeryd.conf /etc/default/celeryd
RUN ln -s ${PROJECT_DIR}/conf/celerybeat.conf /etc/default/celerybeat
RUN ln -s ${PROJECT_DIR}/code/supervisor-app.conf /etc/supervisor/conf.d/

RUN cp ${PROJECT_DIR}/conf/celeryd /etc/init.d/
RUN chmod +x /etc/init.d/celeryd
RUN update-rc.d celeryd defaults
RUN update-rc.d celeryd enable
RUN chown root:root /etc/init.d/celeryd
RUN chmod 755 /etc/init.d/celeryd

RUN cp ${PROJECT_DIR}/conf/celerybeat /etc/init.d/
RUN chmod +x /etc/init.d/celerybeat
RUN update-rc.d celeryd defaults
RUN update-rc.d celeryd enable
RUN chown root:root /etc/init.d/celerybeat
RUN chmod 755 /etc/init.d/celerybeat

service nginx start
service uwsgi start
service celeryd start
service celerybeat start

VOLUME ["/data", \
        "/etc/nginx/site-enabled", "/var/log/nginx", \
        "/etc/uwsgi/apps-enabled", "/var/log/uwsgi", \
        "/var/log/celery", \
        "/var/lib/redis", "/etc/redis"]

EXPOSE 80
EXPOSE 443
# EXPOSE 6379

#CMD ["supervisord", "-n"]

I make this dockerfile. It could build yesterday, but it doesn't work today.

This is a error message. Get:20 http://archive.ubuntu.com trusty/universe amd64 Packages [7589 kB] Fetched 21.4 MB in 1min 3s (336 kB/s) W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/main/binary-amd64/Packages Hash Sum mismatch

E: Some index files failed to download. They have been ignored, or old ones used instead.

I don't know why it doesn't work.

egaoneko
  • 389
  • 1
  • 5
  • 24

1 Answers1

2

Your docker file cannot be used by us to reproduce to the problem since you have some serious project and project dependency resolution in place

Looking at your error lets assume it happens at

FROM ubuntu:14.04
RUN apt-get update

Do you see this multiple times you tried to build.

  1. Hash mismatches can occur if the signed package hash does not match the hash value of the package obtained
  2. You hit the split second where the package is updated in the repo but the signed hash is still being updated

Most likely its 2. Since I ran with 14.04 right now and don't see this.

Get:19 http://archive.ubuntu.com/ubuntu/ trusty/main librtmp0 amd64 2.4+20121230.gitdf6c518-1 [57.5 kB]
Get:20 http://archive.ubuntu.com/ubuntu/ trusty-updates/main libcurl3-gnutls amd64 7.35.0-1ubuntu2.6 [165 kB]
Get:21 http://archive.ubuntu.com/ubuntu/ trusty/main libedit2 amd64 3.1-20130712-2 [86.7 kB]

If you can reproduce the error every time you build it.

  • Please don't post the entire docker file (like i said, it does not help me or anyone else).
  • Do some work comment the entire thing and uncomment one instruction at a time.
  • When you hit the error message edit your post with the block which is not commented.
prateek05
  • 483
  • 2
  • 8