n-insaidoo / docker-alpine-perl-devel

A Alpine-based image suitable for project building

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

alpine-perl-devel

Docker Pulls Docker Build Status

This is a Docker image based on alpine that adds my essential tools to build perl projects.

This includes:

Some common *-dev libs are also included:

  • openssl-dev: allows install of Net::SSLeay;
  • zlib-dev: for Gzip::Faster;
  • expat-dev: for all Expat-based XML parsers;
  • libxml2-dev: allows install of XML::LibXML and friends.

Recommended usage

My usual project Dockerfile uses this image as the first stage, to build the application. The resulting files are then copied over to a new image, using Docker multi-stage builds.

An example:

FROM melopt/alpine-perl-devel AS build

## Add any extra build time libs that you might need
## RUN apk --no-cache add <build-time-needed-packages>

COPY cpanfile* /app/
RUN  cd /app && build-perl-deps

FROM melopt/alpine-perl-runtime

## Add libs and utils that your app might need during runtime
## RUN apk --no-cache add <runtime-needed-packages>

COPY --from=build /app /app

CMD ["your-app-startup"]

Enjoy your small Perl project images.

Extras

build-perl-deps

A utility script is included, build-perl-deps, that checks the current directory for a cpanfile and optionally for a cpanfile.snapshot.

If found, it will use Carton to install your dependencies.

If all goes well, it will cleanup build and cache files to keep your images small.

If an error is detected during the build process, a second install is attempted, with--verbose and if the second one also fails, the content of the ´cpanm build.log` file is printed.

Repository

This image source repository is at https://github.com/melo/docker-alpine-perl-devel.

Author

Pedro Melo melo@simplicidade.org

About

A Alpine-based image suitable for project building


Languages

Language:Perl 78.6%Language:Dockerfile 21.4%