-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from metacpan/haarg/add-uwsgi
add uwsgi and uwsgi-plugin-psgi
- Loading branch information
Showing
1 changed file
with
32 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 / |