Skip to content

Commit

Permalink
container ubi - fix build using DockerfileUBI
Browse files Browse the repository at this point in the history
- bump to ubi9-minimal
- add some dependencies version constraints

Below are some build issues that were fixed by adding those
constraints: data-default < 0.8, base64 < 1.0, envparse < 0.6

```
Installing   morpheus-graphql-core-0.28.1 (lib)
Completed    morpheus-graphql-core-0.28.1 (lib)

Failed to build req-3.13.4.
Build log (
/root/.cache/cabal/logs/ghc-9.6.6/req-3.13.4-f8155ed22596e5f99fa75f7f9678be05506936e7bf2a402afca163eb2b2cc664.log
):
Configuring library for req-3.13.4...
Preprocessing library for req-3.13.4...
Building library for req-3.13.4...
[1 of 1] Compiling Network.HTTP.Req ( Network/HTTP/Req.hs, dist/build/Network/HTTP/Req.o, dist/build/Network/HTTP/Req.dyn_o )

Network/HTTP/Req.hs:610:11: error: [GHC-39999]
    * No instance for `Data.Default.Class.Default NC.TLSSettings'
        arising from a use of `def'
    * In the second argument of `L.mkManagerSettingsContext', namely
        `def'
      In the expression:
        L.mkManagerSettingsContext (Just context) def Nothing
      In an equation for `settings':
          settings = L.mkManagerSettingsContext (Just context) def Nothing
    |
610 |           def
    |           ^^^
Error: [Cabal-7125]
Failed to build req-3.13.4 (which is required by exe:monocle from monocle-1.11.2). See the build log above for details.

Network/TLS/Parameters.hs:404:39: error: [GHC-39999]
    * No instance for `Default ValidationCache'
        arising from a use of `def'
    * In the `sharedValidationCache' field of a record
      In the expression:
        Shared
          {sharedCredentials = mempty,
           sharedSessionManager = noSessionManager, sharedCAStore = mempty,
           sharedValidationCache = def, sharedHelloExtensions = []}
      In an equation for `def':
          def
            = Shared
                {sharedCredentials = mempty,
                 sharedSessionManager = noSessionManager, sharedCAStore = mempty,
                 sharedValidationCache = def, sharedHelloExtensions = []}
    |
404 |             , sharedValidationCache = def
    |                                       ^^^
Error: [Cabal-7125]
Failed to build tls-2.0.6 (which is required by exe:monocle from monocle-1.11.2). See the build log above for details.

src/Monocle/Api/Jwt.hs:108:44: error: [GHC-83865]
    * Couldn't match expected type `base64-1.0:Data.Base64.Types.Internal.Base64
                                      k0 ByteString'
                  with actual type `ByteString'
    * In the first argument of `B64.decodeBase64', namely `bs'
      In the expression: B64.decodeBase64 bs
      In the expression:
        case B64.decodeBase64 bs of
          Right json -> decode $ from json
          Left _ -> Nothing
    |
108 | decodeOIDCState bs = case B64.decodeBase64 bs of
    |                                            ^^

src/CLI.hs:152:8: error:
    Ambiguous occurrence `eitherReader'
    It could refer to
       either `Env.eitherReader',
              imported from `Env' at src/CLI.hs:10:1-40
              (and originally defined in `Env.Internal.Parser')
           or `Options.Applicative.eitherReader',
              imported from `Options.Applicative' at src/CLI.hs:30:1-53
              (and originally defined in `Options.Applicative.Builder')
    |
152 |       (eitherReader $ (first T.unpack . Config.mkIndexName) . T.pack)
    |        ^^^^^^^^^^^^

src/CLI.hs:51:54: error: [GHC-83865]
    * Couldn't match expected type `Int'
                  with actual type `Env.Parser
                                      Env.Error
                                      (FilePath, String, String, String, String, String,
                                       Maybe String, Maybe String)'
    * In the first argument of `Just', namely `usageApiEnv'
      In the fourth argument of `mkCommand', namely `(Just usageApiEnv)'
      In the first argument of `(<>)', namely
        `mkCommand "Start the API" "api" usageApi (Just usageApiEnv)'
   |
51 |     ( mkCommand "Start the API" "api" usageApi (Just usageApiEnv)
   |                                                      ^^^^^^^^^^^
```
  • Loading branch information
morucci committed Jan 7, 2025
1 parent 1fefbf3 commit 3514d1e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 37 deletions.
17 changes: 6 additions & 11 deletions DockerfileUBI
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

##### Monocle binary build #####

FROM registry.access.redhat.com/ubi8/ubi as ubi-builder
FROM registry.access.redhat.com/ubi9/ubi as ubi-builder

# Install gpg keys
RUN gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 7D1E8AFD1D4A16D71FADA2F2CCC85C0E40C06A8C
Expand All @@ -43,7 +43,7 @@ RUN dnf install -y \
gcc-c++


ARG GHC=9.4.6
ARG GHC=9.6.6
ARG CABAL=latest

# Install GHC and cabal
Expand All @@ -57,21 +57,21 @@ RUN dnf install -y \
openssl-devel \
gmp-devel \
ncurses-devel \
ncurses-compat-libs \
zlib-devel

RUN cabal update

# 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
FROM registry.fedoraproject.org/fedora:41 as web-builder

RUN dnf update -y && dnf install -y nodejs git

Expand All @@ -97,12 +97,7 @@ RUN sed -e 's|-bs-no-version-header|-bs-no-version-header", "-warn-error -a+5+6+

##### Setup final image #####

FROM registry.access.redhat.com/ubi8/ubi
FROM registry.access.redhat.com/ubi9/ubi-minimal

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
27 changes: 2 additions & 25 deletions cabal-override.project
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,9 @@ package proto3-suite
packages: .

-- dhall expects aeson < 2.2
constraints: aeson < 2.2
constraints: aeson < 2.2, data-default < 0.8, base64 < 1.0, envparse < 0.6

source-repository-package
type: git
location: https://github.com/awakesecurity/proto3-suite
tag: 88ca7ae30f3ab45a1ca09e348cbeb2c0afac2bb5

source-repository-package
type: git
location: https://github.com/awakesecurity/proto3-wire
tag: 6dcc557fc9d3ffcbfe45c6bea4969830f9e0de9c

source-repository-package
type: git
location: https://github.com/softwarefactory-project/gerrit-haskell
tag: daa44c450f819f3af2879099ec065c1efb973ef8

-- Need Relax bounds: servant, servant-server
source-repository-package
type: git
location: https://github.com/haskell-servant/servant-lucid
tag: 28faa2b57ab01b105c35f30908630900f55b5576

-- Need Relax bounds: default base version due to ghc version
source-repository-package
type: git
location: https://github.com/well-typed/cborg
tag: c8013b3474d876f4da56c869d57e3f3ac7f42dc6
subdir: cborg-json
tag: 53ae1df5eb757fedbfe1ec5f99fc7ed5068928e5
2 changes: 1 addition & 1 deletion src/CLI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ usageJanitor =
elasticOption = strOption (long "elastic" <> O.help "The Elastic endpoint url" <> metavar "MONOCLE_ELASTIC_URL")
workspaceOption =
option
(eitherReader $ (first T.unpack . Config.mkIndexName) . T.pack)
(O.eitherReader $ (first T.unpack . Config.mkIndexName) . T.pack)
(long "workspace" <> O.help "Workspace name" <> metavar "WORKSPACE")
crawlerNameOption = strOption (long "crawler-name" <> O.help "The crawler name" <> metavar "CRAWLER_NAME")
runOnWorkspace env action' workspace = runEff $ runLoggerEffect $ runElasticEffect env $ runEmptyQueryM workspace $ dieOnEsError action'
Expand Down

0 comments on commit 3514d1e

Please sign in to comment.