{"id":15017768,"url":"https://github.com/melo/docker-perl-alt","last_synced_at":"2026-03-07T03:32:18.543Z","repository":{"id":48316102,"uuid":"183821737","full_name":"melo/docker-perl-alt","owner":"melo","description":"A Docker image to manage Perl-based projects","archived":false,"fork":false,"pushed_at":"2024-10-12T18:20:28.000Z","size":172,"stargazers_count":12,"open_issues_count":2,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-12-15T15:17:59.702Z","etag":null,"topics":["docker","perl","perl5"],"latest_commit_sha":null,"homepage":null,"language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/melo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-27T21:07:20.000Z","updated_at":"2025-03-19T07:27:31.000Z","dependencies_parsed_at":"2023-12-10T11:31:14.325Z","dependency_job_id":"7a680468-850c-4091-bb49-639185d60209","html_url":"https://github.com/melo/docker-perl-alt","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/melo/docker-perl-alt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melo%2Fdocker-perl-alt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melo%2Fdocker-perl-alt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melo%2Fdocker-perl-alt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melo%2Fdocker-perl-alt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/melo","download_url":"https://codeload.github.com/melo/docker-perl-alt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melo%2Fdocker-perl-alt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30206574,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T03:24:23.086Z","status":"ssl_error","status_checked_at":"2026-03-07T03:23:11.444Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","perl","perl5"],"created_at":"2024-09-24T19:50:58.107Z","updated_at":"2026-03-07T03:32:18.524Z","avatar_url":"https://github.com/melo.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Perl Docker Image System #\n\n![Docker Pulls](https://img.shields.io/docker/pulls/melopt/perl-alt.svg)\n![Docker Build Status](https://img.shields.io/github/issues/melo/docker-perl-alt.svg)\n\nThis set of images provides a full and extensible setup to run your Perl\napplications with Docker.\n\nThere are three main versions of the image:\n\n* a `-runtime` version that should be used to run the final\n  applications - the final target of your `Dockerfile` should\n  use this one;\n* a `-build` version that can be used to build your applications;\n* a `-devel` version that can be used to debug and develop\n  applications: this is mostly the `-build` version with extra modules.\n\nEach of these is available in combination with an Alpine, the official Perl base image,\nand the `wolfi-base` from the [Chainguard](https://www.chainguard.dev) project.\n\n| Base Image  | Development | Build | Runtime |\n|-------------|-------------|-------|---------|\n| `alpine:3.20` | `alpine-latest-devel` / `alpine-3.20-devel` | `alpine-latest-build` / `alpine-3.20-build`| `alpine-latest-runtime` / `alpine-3.20-runtime` |\n| `alpine:edge` | `alpine-next-devel` / `alpine-edge-devel` | `alpine-next-build` / `alpine-edge-build` | `alpine-next-runtime` / `alpine-edge-runtime` |\n| `perl:5.40-slim` | `perl-latest-devel` / `perl-5.40-slim-devel` | `perl-latest-build` / `perl-5.40-slim-build` | `perl-latest-runtime` / `perl-5.40-slim-runtime` |\n| `perl:5.40` | `perl-full-devel` / `perl-5.40-devel` | `perl-full-build` / `perl-5.40-build` | `perl-full-runtime` / `perl-5.40-runtime` |\n| `cgr.dev/chainguard/wolfi-base` | `chainguard-latest-devel` | `chainguard-latest-build` | `chainguard-latest-runtime` |\n\nSee below how to create a Dockerfile for your project that makes\nfull use of this setup, while making sure that you'll end up with the\nsmallest possible final image.\n\n\n## What's inside? ##\n\nAll images are based on Alpine and Perl images and include:\n\n* [perl](https://metacpan.org/release/perl):\n  * on Alpine images, we use the system `perl`:\n    * 3.20: perl 5.38.2;\n    * edge: perl 5.40.0.\n  * on official Perl images, currently 5.40.0;\n  * on Chainguard images, currently 5.40.0.\n* [cpanm](https://metacpan.org/release/App-cpanminus);\n* [Carton](https://metacpan.org/release/Carton);\n* [App::cpm](https://metacpan.org/release/App-cpm).\n\nSome common libs and tools are also included:\n\n* `openssl`: this is not the default for Alpine, but a lot of software\n  fails to build without it;\n* `zlib`;\n* `expat`;\n* `libxml2` and `libxml-utils`;\n* `jq`.\n\nThe `-build` and `-devel` versions include the development\nversions of these libraries.\n\n\n### Lambda Support (Experimental) ###\n\nThe Lambda support is still experimental. It seems to work fine but we\nare not using it in production at this moment.\n\nThe support includes testing your functions locally using the\n[AWS Lambda Runtime Interface Emulator][AWS-RIE].\n\nMost of the Lambda logic is provided by the excellent [AWS::Lambda][]\nPerl module. Kudos to Shogo Ichinose for this.\n\nYour handlers should be placed in the `lambda-handlers/` of your\nproject. Make sure your `.pl` handlers are executable.\n\nA sample handler (named `functions.pl`) looks like this:\n\n```\n#!perl\n\nuse strict;\nuse warnings;\nuse JSON::MaybeXS;\n\nsub echo {\n  my ($payload, $context) = @_;\n\n  return encode_json({ payload =\u003e $payload, context =\u003e { %$context } });\n}\n\n1;\n```\n\nThe name of this function is `functions.echo`. The first part,\n`functions`, is the name of the handler file, `functions.pl`. The second\npart, `echo`, is the name of the sub called in that file. See\n[AWS::Lambda][] for details on writing Lambda handlers.\n\nTo test the function locally, build your image then run it like this:\n\n```\n$ docker run --rm -it -p 9000:8080 your_image your_handler.your_function\n10 Dec 2022 16:31:26,839 [INFO] (rapid) exec '/var/runtime/bootstrap' (cwd=/app, handler=your_handler.your_function)\n10 Dec 2022 16:31:36,015 [INFO] (rapid) extensionsDisabledByLayer(/opt/disable-extensions-jwigqn8j) -\u003e stat /opt/disable-extensions-jwigqn8j: no such file or directory\n10 Dec 2022 16:31:36,015 [WARNING] (rapid) Cannot list external agents error=open /opt/extensions: no such file or directory\n```\n\nYou can then test with:\n```\n$ curl -XPOST 'http://localhost:9000/2015-03-31/functions/function/invocations' -d '{}'\n```\n\nThe logs will show something like this:\n\n```\nSTART RequestId: 3503ccbd-0dfc-4eba-99f7-5aa72b58692b Version: $LATEST\nEND RequestId: 3503ccbd-0dfc-4eba-99f7-5aa72b58692b\nREPORT RequestId: 3503ccbd-0dfc-4eba-99f7-5aa72b58692b\tInit Duration: 0.36 ms\tDuration: 63.70 ms\tBilled Duration: 64 ms\tMemory Size: 3008 MB\tMax Memory Used: 3008 MB\n```\n\nFor a fully working example see [test/lambda][lambda-test] inside this repository.\n\n\n## Entrypoint ##\n\nThe system includes a standard ENTRYPOINT script that sets a decent\n`PERL5LIB` based on the assumption that your app libs are under\n`/app/lib`.\n\nIt will also check for submodules under `/app/elib/` and include\nall `/app/elib/*/lib` folders in `PERL5LIB`.\n\nFinally, if you need your own ENTRYPOINT script, place an executable\nat `/entrypoint` and it will be executed before the `COMMAND`.\n\n\n## Rational ##\n\nThe system was designed to have a big, fully featured, build-time image,\nand another slim runtime image. A third version that you can use during\ndevelopment time can also be created with a small addition to your\napp `Dockerfile`.\n\nWith a Docker multi-stage build, you can use a single Dockerfile to\nbuild and generate all the images, including the final runtime image.\n\nThe system assumes a specific directory layout for the app, the app\ndependencies, and the \"stack\".\n\n* application is inside `/app`;\n* application dependencies will be installed at `/deps`;\n* stack code and dependencies will be installed at `/stack`;\n\nThe fact that the stack code and dependencies are placed outside the app\nlocations allow you to create Docker images with just the stack\ncomponents that you can reuse between multiple projects. See below for\ntwo sample stacks, one for a Dancer2+Xslate+Starman combo, and another\nto have all the things needed to run a Minion job system.\n\nThe reason to split your app dependencies and your code is to\nallow you to use an image with your work directory from your laptop\nmounted under `/app`. If the app dependencies are in `/deps` and only\nyour code is under `/apps` you can start a container with an image\ncreated from your app Dockerfile, and mount the laptop work directory\nwith `docker run` `-v`-option under `/app` and develop with the same\nenvironment as your deployment environment will look like.\n\n\n# How to use #\n\nBelow you'll find the recommended Dockerfile. The goal is to get a fast\nbuild, making use as much as possible of the Docker build cache, and\nprovide the smallest possible image in the end.\n\nThis is an ordinary application. Dependencies are tracked with\n[Carton](https://metacpan.org/pod/Carton) in a `cpanfile` with the\nassociate `cpanfile.snapshot`.\n\nYou should be able to just copy\u0026paste this sample `Dockerfile` to your\napp work directory, and tweak the `apk add` lines to make sure that\nyou add any packaged dependencies you might need. If you don't need\nany package dependencies, you can just remove those lines altogether.\n\n```Dockerfile\n### First stage, just to add our package dependencies. We put this on a\n### separate stage to be able to reuse them across the \"build\" and\n### \"devel\" phases lower down\nFROM melopt/perl-alt:alpine-latest-build AS package_deps\n\n### Add any packaged dependencies that your application might need. Make\n### sure you use the -devel or -libs package, as this is to be used to\n### build your dependencies and app. The postgres-libs shown below is\n### just an example\nRUN apk --no-cache add postgres-libs\n\n\n### Second stage, build our app. We start from the previous stage, package_deps\nFROM package_deps AS builder\n\n### We copy all cpanfiles (this includes the optional cpanfile.snapshot)\n### to the application directory, and we install the dependencies. Note\n### that by default pdi-build-deps will install our apps dependencies\n### under /deps. This is important later on.\nCOPY cpanfile* /app/\nRUN cd /app \u0026\u0026 pdi-build-deps\n\n### Copy the rest of the application to the app folder\nCOPY . /app/\n\n\n### The third stage is used to create a developers image, based on the\n### package_deps and build phases, and with\n### possible some extra tools that you might want during local\n### development. This layer has no impact on the runtime final version,\n### but can be generated with a `docker build --target devel`\nFROM package_deps AS devel\n\n### Add any packaged dependencies that your application might need\n### during development time. Given that we start from package_deps\n### phase, all package dependencies from the build phase are already\n### included.\nRUN apk --no-cache add jq\n\n### Assuming you have a cpanfile.devel file with all your devel-time\n### dependencies, you can install it with this\nRUN cd /app \u0026\u0026 pdi-build-deps cpanfile.devel\n\n### Copy the App dependencies and the app code\nCOPY --from=builder /deps/ /deps/\nCOPY --from=builder /app/ /app/\n\n### And we are done: this \"development\" image can be generated with:\n###\n###      docker build -t my-app-devel --target devel .\n###\n### You can then run it as:\n###\n###      cd your-app-workdir; docker run -it --rm -v `pwd`:/app my-app-devel\n###\n\n\n### Now for the fourth and final stage, the runtime edition. We start from the\n### runtime version and add all the files from the build phase\nFROM melopt/perl-alt:alpine-latest-runtime\n\n### Add any packaged dependencies that your application might need\nRUN apk --no-cache add postgres-libs\n\n### Copy the App dependencies and the app code\nCOPY --from=builder /deps/ /deps/\nCOPY --from=builder /app/ /app/\n\n### Add the command to start the application\nCMD [ \"your_app_start_command.pl\" ]\n```\n\n## Reuseable Stacks ##\n\nYou can also make stacks with commonly used combinations of packages.\nThe setup is almost the same, the only difference is that when\ninstalling the dependencies and any other software you might need, the\ndestination directory is `/stack`. The `-runtime` image will\nautomatically include all of `/stack` dependencies and libs into\n`PERL5LIB`, and it will also make sure that any commands that are placed\non `bin/` directories are included on our `PATH`.\n\n\n### Dancer2 + Text::Xslate + Starman ###\n\nBelow you'll find an example of a Dockerfile for a stack that provides you:\n\n* Dancer2;\n* Text::Xslate for templating;\n* Starman for a web server.\n\nThis is actually available at [melopt/dancer2-xslate-starman](https://hub.docker.com/r/melopt/dancer2-xslate-starman) (repository is at [Github melo/docker-dancer2-xslate-starman](https://www.github.com/melo/docker-dancer2-xslate-starman)). You can check the [`cpanfile` used for the stack](https://github.com/melo/docker-dancer2-xslate-starman/blob/master/cpanfile).\n\n```Dockerfile\nFROM melopt/perl-alt:alpine-latest-build AS builder\n\nCOPY cpanfile* /stack/\nRUN cd /stack \u0026\u0026 pdi-build-deps --stack\n\n\nFROM melopt/perl-alt:alpine-latest-runtime\n\nCOPY --from=builder /stack /stack/\n```\n\nSome notes about this `Dockerfile`:\n\n* notice that the `pdi-build-deps` is run with the `--stack` option;\n* for the runtime version, we copy the `/stack` folders.\n\nWith this setup, you'll end up with a Docker image for your stack that you can reuse with multiple projects. For example, a simple Dancer2+Xslate-based web app could have a `Dockerfile` like this:\n\n```Dockerfile\n### Package deps, for build and devel phases\nFROM melopt/perl-alt:latest-build AS package_deps\n\nRUN apk --no-cache add mariadb-dev\n\n### Build phase, build our app and our app deps\nFROM package_deps AS builder\n\nCOPY cpanfile* /app/\nRUN cd /app \u0026\u0026 pdi-build-deps\n\nCOPY . /app/\n\n\n### Create the \"development\" image\nFROM package_deps AS devel\n\nRUN apk --no-cache add jq\nRUN cd /app \u0026\u0026 pdi-build-deps cpanfile.devel\n\nCOPY --from=builder /deps/ /deps/\nCOPY --from=builder /app/ /app/\n\n\n### Final phase: the runtime version - notice that we start from the stack image\nFROM melopt/dancer2-xslate-starman\n\nENV PLACK_ENV=production\nRUN apk --no-cache add mariadb-client\n\nCOPY --from=builder /deps/ /deps/\nCOPY --from=builder /app/ /app/\n\nCMD [ \"plackup\", \"--port\", \"80\", \"--server\", \"Starman\" ]\n```\n\n### Minion ###\n\nAnother stack, this time to allow users to run Minion workers and the admin interface. You can find the image at [melopt/minion](https://hub.docker.com/r/melopt/minion) (repository at [Github melo/docker-minion](https://github.com/melo/docker-minion)).\n\n```Dockerfile\n### Prepare the dependencies\nFROM melopt/perl-alt:alpine-latest-build AS builder\n\nRUN apk --no-cache add mariadb-dev postgresql-dev\n\nCOPY cpanfile* /stack/\nRUN  cd /stack \u0026\u0026 pdi-build-deps --stack\n\n### This stack includes some helper scripts\nCOPY bin /stack/bin/\n### small \"test phase\", just to catch stupid mistakes...\nRUN set -e \u0026\u0026 cd /stack \u0026\u0026 for script in bin/* ; do perl -wc $script ; done\n\n\n### Runtime image\nFROM melopt/perl-alt:alpine-latest-runtime\n\nRUN apk --no-cache add mariadb-client postgresql-libs\n\nCOPY --from=builder /stack /stack\n\nENTRYPOINT [ \"/stack/bin/minion-entrypoint\" ]\n```\n\n\n# Repository #\n\nThis image source repository is at [https://github.com/melo/docker-perl-alt][repo].\n\n\n# Author #\n\nPedro Melo [melo@simplicidade.org](mailto:melo@simplicidade.org)\n\n[repo]: https://github.com/melo/docker-perl-alt\n[AWS-RIE]: https://github.com/aws/aws-lambda-runtime-interface-emulator\n[AWS::Lambda]: https://metacpan.org/pod/AWS::Lambda\n[lambda-test]: https://github.com/melo/docker-perl-alt/tree/master/test/lambda\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmelo%2Fdocker-perl-alt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmelo%2Fdocker-perl-alt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmelo%2Fdocker-perl-alt/lists"}