Skip to content

Commit

Permalink
Merge pull request #7 from metacpan/haarg/add-uwsgi
Browse files Browse the repository at this point in the history
add uwsgi and uwsgi-plugin-psgi
  • Loading branch information
haarg authored Feb 7, 2024
2 parents a6dace8 + a298d68 commit aeba053
Showing 1 changed file with 32 additions and 6 deletions.
38 changes: 32 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,41 @@
ARG PERL_VERSION=5.36
FROM perl:${PERL_VERSION} AS build

FROM perl:${PERL_VERSION} AS build-uwsgi

WORKDIR /
RUN \
--mount=type=cache,target=/var/cache/apt,sharing=private \
--mount=type=cache,target=/var/lib/apt/lists,sharing=private \
<<EOT /bin/bash -euo pipefail
apt-get update
apt-get install -y build-essential libcap-dev libpcre3-dev uwsgi-core uwsgi-src
/usr/bin/uwsgi --build-plugin "/usr/src/uwsgi/plugins/psgi"
EOT

FROM perl:${PERL_VERSION} AS build-perl

WORKDIR /metacpan
COPY cpanfile cpanfile.snapshot /metacpan/

# cpm needs Carton::Snapshot to read cpanfile.snapshot
RUN cpanm App::cpm \
&& cpm install -g Carton::Snapshot \
&& cpm install -g
RUN \
--mount=type=cache,target=/var/cache/apt,sharing=private \
--mount=type=cache,target=/var/lib/apt/lists,sharing=private \
<<EOT /bin/bash -euo pipefail
cpm install -g Carton::Snapshot
cpm install -g
EOT

FROM perl:${PERL_VERSION}
COPY --from=build /usr/local/lib/perl5 /usr/local/lib/perl5
COPY --from=build /usr/local/bin /usr/local/bin

RUN --mount=type=cache,target=/var/cache/apt,sharing=private \
<<EOT /bin/bash -euo pipefail
useradd -m metacpan -g users
apt-get update
apt-get install -y uwsgi-core
EOT

COPY --from=build-uwsgi psgi_plugin.so /usr/lib/uwsgi/plugins/psgi_plugin.so
COPY --from=build-perl /usr/local/lib/perl5 /usr/local/lib/perl5
COPY --from=build-perl /usr/local/bin /usr/local/bin
COPY wait-for-it.sh /

0 comments on commit aeba053

Please sign in to comment.