i am trying to build docker image for wso2 api manager 4.2.0

124 Views Asked by At

hello guys i finished working on my wso2 api manager configs and now i am trying to build a docker images i followed docs and created zip file of wso2 folder and copied the entrypoint and docker file from github and run my script but i keep getting this problem

chown: cannot access '/home/wso2carbon/wso2am-4.2.0': No such file or directory
------
Dockerfile:107
--------------------
 106 |     # add the WSO2 product distribution to user's home directory
 107 | >>> RUN \
 108 | >>>     wget -O ${WSO2_SERVER}.zip "${WSO2_SERVER_DIST_URL}" \
 109 | >>>     && unzip -d ${USER_HOME} ${WSO2_SERVER}.zip \
 110 | >>>     && chown wso2carbon:wso2 -R ${WSO2_SERVER_HOME} \
 111 | >>>     && mkdir ${USER_HOME}/wso2-tmp \
 112 | >>>     && bash -c 'mkdir -p ${USER_HOME}/solr/{indexed-data,database}' \
 113 | >>>     && chown wso2carbon:wso2 -R ${USER_HOME}/solr \
 114 | >>>     && cp -r ${WSO2_SERVER_HOME}/repository/deployment/server/synapse-configs ${USER_HOME}/wso2-tmp \
 115 | >>>     && cp -r ${WSO2_SERVER_HOME}/repository/deployment/server/executionplans ${USER_HOME}/wso2-tmp \
 116 | >>>     && rm -f ${WSO2_SERVER}.zip

i change the WSO2_SERVER_DIST_URL with its value:

ARG USER=wso2carbon
ARG USER_ID=802
ARG USER_GROUP=wso2
ARG USER_GROUP_ID=802
ARG USER_HOME=/home/${USER}
# build arguments for WSO2 product installation
ARG WSO2_SERVER_NAME=wso2am
ARG WSO2_SERVER_VERSION=4.2.0
ARG WSO2_SERVER_REPOSITORY=product-apim
ARG WSO2_SERVER=${WSO2_SERVER_NAME}-${WSO2_SERVER_VERSION}
ARG WSO2_SERVER_HOME=${USER_HOME}/${WSO2_SERVER}
ARG WSO2_SERVER_DIST_URL=https://github.com/wso2/product-apim/archive/refs/tags/v4.2.0.zip 
...
RUN \
    wget -O ${WSO2_SERVER}.zip "${WSO2_SERVER_DIST_URL}" \
    && unzip -d ${USER_HOME} ${WSO2_SERVER}.zip \
    && chown wso2carbon:wso2 -R ${WSO2_SERVER_HOME} \
    && mkdir ${USER_HOME}/wso2-tmp \
    && bash -c 'mkdir -p ${USER_HOME}/solr/{indexed-data,database}' \
    && chown wso2carbon:wso2 -R ${USER_HOME}/solr \
    && cp -r ${WSO2_SERVER_HOME}/repository/deployment/server/synapse-configs ${USER_HOME}/wso2-tmp \
    && cp -r ${WSO2_SERVER_HOME}/repository/deployment/server/executionplans ${USER_HOME}/wso2-tmp \
    && rm -f ${WSO2_SERVER}.zip

and then run docker build -t wso2am:4.2.0 .

2

There are 2 best solutions below

0
Sebastian Liebscher On BEST ANSWER

The issue is that WSO2 AM does not provide binaries for versions 4.1.0 and 4.2.0. Instead, it looks like you have to create them yourself for both versions.

As of Feb. 2024: WSO2 AM has pre-releases like 4.3.0-m2 which provide binaries again.

So, if you change these arguments:

ARG WSO2_SERVER_VERSION=4.3.0-m2
ARG WSO2_SERVER_DIST_URL=https://github.com/wso2/${WSO2_SERVER_REPOSITORY}/releases/download/v${WSO2_SERVER_VERSION}/${WSO2_SERVER}.zip

(works with 4.0.0 and 4.3.0-m2)

Difference between release with binaries:

release with binaries

and without binaries

release without binaries

0
RrR- On

I don't think https://github.com/wso2/product-apim/archive/refs/tags/v4.2.0.zip has the product pack. That url must be downloading the zipped version of the product code. You need to either build and get the pack (this is in modules/distribution/product/target location) or you need to get the product pack from the website. You can then host that product pack somewhere and use that url in the Dockerfile.