-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
container-image: provide a Monocle container based on UBI 8 #1070
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -0,0 +1,108 @@ | ||
# Monocle. | ||
# Copyright (C) 2023 Monocle authors | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as published | ||
# by the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
# This Container file builds an an alternative image based on the Universal Base Image | ||
# maintained by Red Hat. This Monocle build might be slightly different than | ||
# the build from the official Monocle base image based on Nix (ghc version and some | ||
# dependencies version might differ). | ||
|
||
|
||
##### Monocle binary build ##### | ||
|
||
FROM registry.access.redhat.com/ubi8/ubi as ubi-builder | ||
|
||
# Install gpg keys | ||
RUN gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 7D1E8AFD1D4A16D71FADA2F2CCC85C0E40C06A8C | ||
RUN gpg --batch --keyserver keyserver.ubuntu.com --recv-keys FE5AB6C91FEA597C3B31180B73EDE9E8CFBAEF01 | ||
RUN gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 88B57FCF7DB53B4DB3BFA4B1588764FBE22D19C4 | ||
RUN gpg --batch --keyserver keyserver.ubuntu.com --recv-keys EAF2A9A722C0C96F2B431CA511AAD8CEDEE0CAEF | ||
|
||
# Install ghcup | ||
RUN \ | ||
curl https://downloads.haskell.org/~ghcup/x86_64-linux-ghcup > /usr/bin/ghcup && \ | ||
chmod +x /usr/bin/ghcup && \ | ||
ghcup config set gpg-setting GPGStrict | ||
|
||
# Install build deps for ghcup | ||
RUN dnf install -y \ | ||
make \ | ||
gcc \ | ||
gcc-c++ | ||
|
||
|
||
ARG GHC=9.4.6 | ||
ARG CABAL=latest | ||
|
||
# Install GHC and cabal | ||
RUN \ | ||
ghcup -v install ghc --isolate /usr/local --force ${GHC} && \ | ||
ghcup -v install cabal --isolate /usr/local/bin --force ${CABAL} | ||
|
||
# Install build deps for Monocle | ||
RUN dnf install -y \ | ||
git \ | ||
openssl-devel \ | ||
gmp-devel \ | ||
ncurses-devel \ | ||
ncurses-compat-libs \ | ||
zlib-devel | ||
|
||
# Copy source tree | ||
COPY . /build | ||
|
||
# Build Monocle | ||
RUN cd /build && \ | ||
cabal update && \ | ||
cabal build --project-file=cabal-override.project && \ | ||
cp $(find dist-newstyle/build/*/*/*/*/monocle/build/ -name monocle -type f) / | ||
|
||
##### Monocle Web UI build ##### | ||
|
||
FROM registry.fedoraproject.org/fedora:35 as web-builder | ||
|
||
RUN dnf update -y && dnf install -y nodejs git | ||
|
||
# set working directory | ||
WORKDIR /monocle-webapp | ||
ENV PATH /monocle-webapp/node_modules/.bin:$PATH | ||
|
||
# copy files to install js modules | ||
COPY web/package.json /monocle-webapp/ | ||
COPY web/bsconfig.json /monocle-webapp/ | ||
COPY web/package-lock.json /monocle-webapp/ | ||
|
||
# install dependencies | ||
RUN npm install | ||
|
||
# copy source files | ||
COPY web/build.js /monocle-webapp/ | ||
COPY web/public /monocle-webapp/public/ | ||
COPY web/src /monocle-webapp/src/ | ||
|
||
# install dependencies (sed is ugly hack to make warning errors) | ||
RUN sed -e 's|-bs-no-version-header|-bs-no-version-header", "-warn-error -a+5+6+27+101+109|' -i bsconfig.json && npm run build | ||
|
||
##### Setup final image ##### | ||
|
||
FROM registry.access.redhat.com/ubi8/ubi | ||
|
||
COPY --from=ubi-builder /monocle /bin/ | ||
COPY --from=web-builder /monocle-webapp/build /usr/share/monocle/webapp/ | ||
|
||
# Ensure runtime commands | ||
RUN dnf install -y curl && \ | ||
dnf clean all && \ | ||
rm -rf /var/cache/yum |
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
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What was the issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On that image I use ghc 9.4 and it seems that
isLowerCase
is only available from base 4.18 1, however base 4.18 is available with ghc 9.6 2.This PR uses ghc 9.4, however ideally using 9.6 will be better as that's the one we use under nix. Dependencies issues went a bit too far using 9.6 then I stopped and fallback to use 9.4 for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation.