-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
149 additions
and
409 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,39 +1,87 @@ | ||
FROM mozillabteam/bmo-perl-slim:20200505.1 | ||
|
||
ENV DEBIAN_FRONTEND noninteractive | ||
|
||
ARG CI | ||
ARG CIRCLE_SHA1 | ||
ARG CIRCLE_BUILD_URL | ||
|
||
ENV CI=${CI} | ||
ENV CIRCLE_BUILD_URL=${CIRCLE_BUILD_URL} | ||
ENV CIRCLE_SHA1=${CIRCLE_SHA1} | ||
|
||
ENV LOG4PERL_CONFIG_FILE=log4perl-json.conf | ||
|
||
RUN apt-get install -y rsync | ||
|
||
# we run a loopback logging server on this TCP port. | ||
ENV LOGGING_PORT=5880 | ||
|
||
ENV LOCALCONFIG_ENV=1 | ||
|
||
# This file is generated by Dockerfile.PL. Do not edit directly. | ||
FROM perl:5.36.0-slim AS builder | ||
WORKDIR /app | ||
|
||
COPY . /app | ||
|
||
RUN chown -R app.app /app && \ | ||
perl -I/app -I/app/local/lib/perl5 -c -E 'use Bugzilla; BEGIN { Bugzilla->extensions }' && \ | ||
perl -c /app/scripts/entrypoint.pl | ||
|
||
USER app | ||
|
||
RUN perl checksetup.pl --no-database --default-localconfig && \ | ||
rm -rf /app/data /app/localconfig && \ | ||
mkdir /app/data | ||
|
||
EXPOSE 8000 | ||
|
||
ENTRYPOINT ["/app/scripts/entrypoint.pl"] | ||
CMD ["httpd"] | ||
COPY Makefile.PL gen-cpanfile.pl Bugzilla.pm /app/ | ||
COPY extensions/LimitedEmail/Config.pm /app/extensions/LimitedEmail/Config.pm | ||
COPY extensions/LimitedEmail/disabled /app/extensions/LimitedEmail/disabled | ||
COPY extensions/AntiSpam/Config.pm /app/extensions/AntiSpam/Config.pm | ||
COPY extensions/AntiSpam/lib/Config.pm /app/extensions/AntiSpam/lib/Config.pm | ||
COPY extensions/TypeSniffer/Config.pm /app/extensions/TypeSniffer/Config.pm | ||
COPY extensions/Ember/Config.pm /app/extensions/Ember/Config.pm | ||
COPY extensions/Ember/disabled /app/extensions/Ember/disabled | ||
COPY extensions/RestrictComments/Config.pm /app/extensions/RestrictComments/Config.pm | ||
COPY extensions/RestrictComments/lib/Config.pm /app/extensions/RestrictComments/lib/Config.pm | ||
COPY extensions/ShadowBugs/Config.pm /app/extensions/ShadowBugs/Config.pm | ||
COPY extensions/ShadowBugs/disabled /app/extensions/ShadowBugs/disabled | ||
COPY extensions/Review/Config.pm /app/extensions/Review/Config.pm | ||
COPY extensions/TagNewUsers/Config.pm /app/extensions/TagNewUsers/Config.pm | ||
COPY extensions/FlagDefaultRequestee/Config.pm /app/extensions/FlagDefaultRequestee/Config.pm | ||
COPY extensions/Push/Config.pm /app/extensions/Push/Config.pm | ||
COPY extensions/Push/lib/Config.pm /app/extensions/Push/lib/Config.pm | ||
COPY extensions/OpenGraph/Config.pm /app/extensions/OpenGraph/Config.pm | ||
COPY extensions/OpenGraph/lib/Config.pm /app/extensions/OpenGraph/lib/Config.pm | ||
COPY extensions/GitHubAuth/Config.pm /app/extensions/GitHubAuth/Config.pm | ||
COPY extensions/GitHubAuth/lib/Config.pm /app/extensions/GitHubAuth/lib/Config.pm | ||
COPY extensions/ContributorEngagement/Config.pm /app/extensions/ContributorEngagement/Config.pm | ||
COPY extensions/BugmailFilter/Config.pm /app/extensions/BugmailFilter/Config.pm | ||
COPY extensions/EditTable/Config.pm /app/extensions/EditTable/Config.pm | ||
COPY extensions/Profanivore/Config.pm /app/extensions/Profanivore/Config.pm | ||
COPY extensions/EditComments/Config.pm /app/extensions/EditComments/Config.pm | ||
COPY extensions/BzAPI/Config.pm /app/extensions/BzAPI/Config.pm | ||
COPY extensions/SecureMail/Config.pm /app/extensions/SecureMail/Config.pm | ||
COPY extensions/SecureMail/disabled /app/extensions/SecureMail/disabled | ||
COPY extensions/BugModal/Config.pm /app/extensions/BugModal/Config.pm | ||
COPY extensions/InlineHistory/Config.pm /app/extensions/InlineHistory/Config.pm | ||
COPY extensions/Bitly/Config.pm /app/extensions/Bitly/Config.pm | ||
COPY extensions/OrangeFactor/Config.pm /app/extensions/OrangeFactor/Config.pm | ||
COPY extensions/UserStory/Config.pm /app/extensions/UserStory/Config.pm | ||
COPY extensions/FlagTypeComment/Config.pm /app/extensions/FlagTypeComment/Config.pm | ||
COPY extensions/SiteMapIndex/Config.pm /app/extensions/SiteMapIndex/Config.pm | ||
COPY extensions/Gravatar/Config.pm /app/extensions/Gravatar/Config.pm | ||
COPY extensions/BMO/Config.pm /app/extensions/BMO/Config.pm | ||
COPY extensions/MozProjectReview/Config.pm /app/extensions/MozProjectReview/Config.pm | ||
COPY extensions/RequestNagger/Config.pm /app/extensions/RequestNagger/Config.pm | ||
COPY extensions/Splinter/Config.pm /app/extensions/Splinter/Config.pm | ||
COPY extensions/Splinter/lib/Config.pm /app/extensions/Splinter/lib/Config.pm | ||
COPY extensions/UserProfile/Config.pm /app/extensions/UserProfile/Config.pm | ||
COPY extensions/Voting/Config.pm /app/extensions/Voting/Config.pm | ||
COPY extensions/GoogleAnalytics/Config.pm /app/extensions/GoogleAnalytics/Config.pm | ||
COPY extensions/GoogleAnalytics/lib/Config.pm /app/extensions/GoogleAnalytics/lib/Config.pm | ||
COPY extensions/Example/Config.pm /app/extensions/Example/Config.pm | ||
COPY extensions/Example/disabled /app/extensions/Example/disabled | ||
COPY extensions/Example/lib/Config.pm /app/extensions/Example/lib/Config.pm | ||
COPY extensions/MyDashboard/Config.pm /app/extensions/MyDashboard/Config.pm | ||
COPY extensions/Needinfo/Config.pm /app/extensions/Needinfo/Config.pm | ||
COPY extensions/LastResolved/Config.pm /app/extensions/LastResolved/Config.pm | ||
COPY extensions/GuidedBugEntry/Config.pm /app/extensions/GuidedBugEntry/Config.pm | ||
COPY extensions/PhabBugz/Config.pm /app/extensions/PhabBugz/Config.pm | ||
COPY extensions/PhabBugz/lib/Config.pm /app/extensions/PhabBugz/lib/Config.pm | ||
COPY extensions/REMO/Config.pm /app/extensions/REMO/Config.pm | ||
COPY extensions/ZPushNotify/Config.pm /app/extensions/ZPushNotify/Config.pm | ||
COPY extensions/ProdCompSearch/Config.pm /app/extensions/ProdCompSearch/Config.pm | ||
COPY extensions/TrackingFlags/Config.pm /app/extensions/TrackingFlags/Config.pm | ||
COPY extensions/ComponentWatching/Config.pm /app/extensions/ComponentWatching/Config.pm | ||
COPY extensions/Webhooks/Config.pm /app/extensions/Webhooks/Config.pm | ||
COPY extensions/Webhooks/lib/Config.pm /app/extensions/Webhooks/lib/Config.pm | ||
COPY extensions/OldBugMove/Config.pm /app/extensions/OldBugMove/Config.pm | ||
COPY extensions/OldBugMove/disabled /app/extensions/OldBugMove/disabled | ||
RUN perl Makefile.PL && \ | ||
cpanm --notest Module::CPANfile && \ | ||
make cpanfile && \ | ||
cpanm --notest App::cpm && \ | ||
apt-get update -y && \ | ||
apt-get install -y libssl-dev libxml2-dev libexpat1-dev build-essential && \ | ||
apt-get install -y default-libmysqlclient-dev && \ | ||
cpm install --show-build-log-on-failure && \ | ||
apt-get install -y apt-file && \ | ||
apt-file update && \ | ||
find local/lib -name '*.so' -exec ldd {} \; | awk '/=>/ {print $3}'|sort -u |xargs -IFILENAME apt-file search FILENAME | awk -F': ' '{print $1}'|sort -u > PACKAGES; | ||
FROM perl:5.36.0-slim | ||
WORKDIR /app | ||
COPY --from=builder /app/PACKAGES /app/PACKAGES | ||
RUN apt-get update -y && apt-get install -y $(cat PACKAGES) | ||
COPY --from=builder /app/local /app/local | ||
COPY ./ /app/ | ||
env LOCALCONFIG_ENV 1 | ||
ENTRYPOINT ["perl", "bugzilla.pl"] | ||
CMD ["daemon"] |
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 |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/usr/bin/env perl | ||
use 5.10.1; | ||
use File::Find; | ||
use experimental 'signatures'; | ||
use autodie; | ||
|
||
my $output = shift @ARGV || 'Dockerfile'; | ||
|
||
open my $fh, '>', $output; | ||
|
||
say $fh "# This file is generated by Dockerfile.PL. Do not edit directly."; | ||
say $fh q{FROM perl:5.36.0-slim AS builder}; | ||
say $fh q{WORKDIR /app}; | ||
say $fh q{COPY Makefile.PL gen-cpanfile.pl Bugzilla.pm /app/}; | ||
|
||
find_extensions($fh); | ||
|
||
RUN(q{ | ||
perl Makefile.PL && | ||
cpanm --notest Module::CPANfile && | ||
make cpanfile && | ||
cpanm --notest App::cpm && | ||
apt-get update -y && | ||
apt-get install -y libssl-dev libxml2-dev libexpat1-dev build-essential && | ||
apt-get install -y default-libmysqlclient-dev && | ||
cpm install --show-build-log-on-failure && | ||
apt-get install -y apt-file && | ||
apt-file update && | ||
find local/lib -name '*.so' -exec ldd {} \; | awk '/=>/ {print $3}'|sort -u |xargs -IFILENAME apt-file search FILENAME | awk -F': ' '{print $1}'|sort -u > PACKAGES; | ||
}); | ||
|
||
say $fh q{FROM perl:5.36.0-slim}; | ||
say $fh q{WORKDIR /app}; | ||
say $fh q{COPY --from=builder /app/PACKAGES /app/PACKAGES}; | ||
say $fh q{RUN apt-get update -y && apt-get install -y $(cat PACKAGES) }; | ||
# several lines should be merged together, and we need to make sure to clean up | ||
# the apt package cache after installing packages to maintain a small image size | ||
say $fh q{COPY --from=builder /app/local /app/local}; | ||
say $fh q{COPY ./ /app/}; | ||
|
||
say $fh q{env LOCALCONFIG_ENV 1}; | ||
say $fh q{ENTRYPOINT ["perl", "bugzilla.pl"]}; | ||
say $fh q{CMD ["daemon"]}; | ||
|
||
sub find_extensions($fh) { | ||
find( | ||
sub { | ||
return unless -f; | ||
return unless $_ eq 'Config.pm' or $_ eq 'disabled'; | ||
my $path = $File::Find::name; | ||
say $fh "COPY $path /app/$path"; | ||
}, | ||
'extensions', | ||
); | ||
} | ||
|
||
sub RUN($cmd) { | ||
# trim leading whitespace and trailing whitespace | ||
$cmd =~ s/^\s+|\s+$//g; | ||
# escape newlines for Dockerfile | ||
$cmd =~ s/\n/ \\\n/gs; | ||
say $fh "RUN $cmd"; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.