Code Monkey home page Code Monkey logo

dfcpp's Introduction

dfcpp - Dockerfile post-processing by cpanfile.

Automatically creates separate docker layer for each Perl module, mentioned in cpanfile

Simple console utility for Perl developers. Saves time when debugging what is wrong during docker container build.

Problem

It's not possible to run container from layer corresponding to last failed module.

Sometimes you are getting module install error, like Installing WWW::Telegram::BotAPI failed.

It's bit of complicated to define the reason because cpanm puts info about error in a separate file, like /root/.cpanm/work/1517580036.144/build.log, but you can't access this file in case of Docker container build since Docker doesn't save result of failed build.

dfcpp auto-rewrites Dockerfile so that each module is installing by separate command (like RUN cpanm WWW::Telegram::BotAPI), so in new layer (each Dockerfile command = separate layer), instead of installing modules batch way (like cpanm --installdeps .) in a single layer.

This approach saves much time if you have a lot of modules.

To troubleshot you just need to run stopped container, which is the result of last successfully executed command in Dockerfile ( = last successfully installed module).

Example

Dockerfile:

RUN apk update && \
...
cpanm --installdeps . && \
...

cpanfile:

requires 'List::MoreUtils';
requires 'Mojolicious::Lite';
requires 'MongoDB';
requires 'WWW::Telegram::BotAPI';

resulted Dockerfile:

RUN cpanm List::MoreUtils
RUN cpanm Mojolicious::Lite
RUN cpanm MongoDB
RUN cpanm WWW::Telegram::BotAPI

Installing

From Github directly using wget, without git clone

wget https://raw.githubusercontent.com/pavelsr/dfcpp/master/dfcpp.pl -O /usr/bin/dfcpp
chmod +x /usr/bin/dfcpp

For local testing and developing after git clone

sudo ln -s ${PWD}/dfcpp.pl /usr/bin/dfcpp
chmod +x /usr/bin/dfcpp

TO DO

  • --help or man
  • undo changes
  • Python (requirements.txt), Nodejs (package.json) and other languages
  • Show latest stopped docker container

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.