docker: dockerfile cleanups

* Use LABEL instead of the deprecated MAINTAINER

* Use COPY instead of ADD. There's no difference in operation here, it's
  just that we don't need the extra magic that ADD provides and best
  practice is to use COPY in that case.

* Fix the mkdir /opt/workdir line - it wasn't being run since it was a
  CMD not RUN, and thus was overridden by a later CMD directive.

* Drop the CMD line to run celery - having more than one CMD directive
  does not work. We'll launch a separate container to run it instead.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
Paul Eggleton 2018-07-09 15:41:30 +02:00
parent be52a5a7b1
commit 5ee59b1564
2 changed files with 9 additions and 12 deletions

View File

@ -1,5 +1,5 @@
FROM buildpack-deps:latest FROM buildpack-deps:latest
MAINTAINER Michael Halstead <mhalstead@linuxfoundation.org> LABEL maintainer="Michael Halstead <mhalstead@linuxfoundation.org>"
EXPOSE 80 EXPOSE 80
ENV PYTHONUNBUFFERED 1 ENV PYTHONUNBUFFERED 1
@ -20,21 +20,18 @@ RUN apt-get install -y --no-install-recommends \
RUN pip install --upgrade pip RUN pip install --upgrade pip
RUN pip install gunicorn RUN pip install gunicorn
RUN pip install setuptools RUN pip install setuptools
CMD mkdir /opt/workdir RUN mkdir /opt/workdir
ADD . /opt/layerindex COPY . /opt/layerindex
RUN pip install -r /opt/layerindex/requirements.txt RUN pip install -r /opt/layerindex/requirements.txt
ADD settings.py /opt/layerindex/settings.py COPY settings.py /opt/layerindex/settings.py
ADD docker/updatelayers.sh /opt/updatelayers.sh COPY docker/updatelayers.sh /opt/updatelayers.sh
ADD docker/migrate.sh /opt/migrate.sh COPY docker/migrate.sh /opt/migrate.sh
## Uncomment to add a .gitconfig file within container ## Uncomment to add a .gitconfig file within container
#ADD docker/.gitconfig /root/.gitconfig #COPY docker/.gitconfig /root/.gitconfig
## Uncomment to add a proxy script within container, if you choose to ## Uncomment to add a proxy script within container, if you choose to
## do so, you will also have to edit .gitconfig appropriately ## do so, you will also have to edit .gitconfig appropriately
#ADD docker/git-proxy /opt/bin/git-proxy #COPY docker/git-proxy /opt/bin/git-proxy
# Start Gunicorn # Start Gunicorn
CMD ["/usr/local/bin/gunicorn", "wsgi:application", "--workers=4", "--bind=:5000", "--log-level=debug", "--chdir=/opt/layerindex"] CMD ["/usr/local/bin/gunicorn", "wsgi:application", "--workers=4", "--bind=:5000", "--log-level=debug", "--chdir=/opt/layerindex"]
# Start Celery
CMD ["/usr/local/bin/celery", "-A", "layerindex.tasks", "worker", "--loglevel=info", "--workdir=/opt/layerindex"]

View File

@ -1,4 +1,4 @@
FROM nginx:latest FROM nginx:latest
MAINTAINER Michael Halstead <mhalstead@linuxfoundation.org> LABEL maintainer="Michael Halstead <mhalstead@linuxfoundation.org>"
COPY docker/nginx.conf /etc/nginx/nginx.conf COPY docker/nginx.conf /etc/nginx/nginx.conf
COPY layerindex/static /usr/share/nginx/html/static COPY layerindex/static /usr/share/nginx/html/static