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"]
我制作了这个dockerfile。 它可以在昨天建造,但它今天不起作用。
这是一条错误消息。 获取:20 http://archive.ubuntu.com可信/宇宙amd64包[7589 kB] 在1分3秒内获得21.4 MB(336 kB / s) W:无法获取http://archive.ubuntu.com/ubuntu/dists/trusty-updates/main/binary-amd64/Packages哈希和不匹配
E: Some index files failed to download. They have been ignored, or old ones used instead.
我不知道为什么它不起作用。
答案 0 :(得分:1)
我们无法使用您的docker文件重现问题,因为您已经有一些严肃的项目和项目依赖性解决方案
查看您的错误,假设它发生在
FROM ubuntu:14.04
RUN apt-get update
您是否多次尝试过这种情况。
很可能是它2.因为我现在以14.04跑,并没有看到这一点。
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]
如果每次构建错误都可以重现错误。