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.
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 <packages>
COPY cpanfile cpanfile.snapshot /app/
RUN cd /app && carton install --deployment && rm -rf local/cache ~/.cpanm*
FROM melopt/alpine-perl-runtime
## Add all run time libs and utils that you might need
## RUN apk --no-cache add <packages>
COPY --from=build /app /app
CMD ["your-app-startup"]
Enjoy your small Perl project images.
This image source repository is at https://github.com/melo/docker-alpine-perl-devel.
Pedro Melo melo@simplicidade.org