Giter Club home page Giter Club logo

ewas_dap's People

Contributors

basharatbhat avatar chrisdjscott avatar markolaban avatar sirselim avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ewas_dap's Issues

Reduce layers in the Dockerfile

There are several RUN commands. Each creating a layer. Changes in the Dockerfile may result in several layers being—possibly—unnecessarily re-created.

Here's a possible version:

FROM php:7.4-apache

# Copy files
COPY src/ /var/www/html
COPY php.ini $PHP_INI_DIR/conf.d/
COPY ports.conf /etc/apache2/ports.conf
COPY main.sh main.sh
COPY dependencies/ /usr/local/lib/R/site-library/mailR/java

# System dependencies
RUN echo 'deb http://cloud.r-project.org/bin/linux/debian buster-cran40/' >> /etc/apt/sources.list && \
	apt-key adv --keyserver keys.gnupg.net --recv-key 'E19F5F87128899B192B1A2C2AD5F960A256A04AF' && \
	apt-get update && \
	apt-get install -y -t
		gnupg2 \
		buster-cran40 \
		r-base \
		r-base-dev \
		r-recommendedlibssl-dev \
		libcurl4-openssl-dev \
		libxml2-dev \
		msmtp \
		default-jre \
		default-jdk && \
	mkdir /usr/share/man/man1/ && \
	rm -rf /var/lib/apt/lists/*

# R configuration and dependencies
RUN R CMD javareconf && \
	Rscript /var/www/html/install_packages.R && \
	chmod +x /var/www/html/sws/csvtk

EXPOSE 8083

That way, changing something int he R configuration & dependencies, should be much quicker, since it will only run that layer.

Changing any dependencies, won't trigger new COPY commands as those are executed before (creating layers).

See https://docs.docker.com/develop/develop-images/dockerfile_best-practices/ there's more that can be applied in the Dockerfile to speed up the build, and possibly reduce the final image size too. I've only included one command above to clear apt files, but there are other good tips in there 👍

Reduce container context size

Without a .dockerignore, Docker will send everything in the build directory for the build context.

kinow@ranma:~/Development/python/workspace/EWAS_DAP$ ./build_docker 
Sending build context to Docker daemon  80.92MB

I added just .git and jupyterhub for a quick experiment.

kinow@ranma:~/Development/python/workspace/EWAS_DAP$ ./build_docker 
Sending build context to Docker daemon  26.51MB

That reduces risks of accidentally including sensitive info in the build context, and may improve the build time for the Docker container.

See: https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#exclude-with-dockerignore

sudo not necessary for building a Docker container (?)

In the readme, it points the user to use sudo for building a Docker container. But if users have right group access in the operating system, there's no need for sudo. Only when using the privileged mode for running I think.

I've successfully built it without the sudo (though it took ages, which is normal 😬 I believe).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.