Forum Discussion

cjdinger's avatar
cjdinger
Leader
4 years ago

Community plugin SDK in Docker

Hi All,

Like others in the Developer forum here, I use the plugin SDK and sometimes struggle to set up the development environment. My main machine is Windows and that's not officially supported for the SDK. For a long time I've used a Linux VM hosted at my company, but as we're working from home that tends to be slower to access now, especially with all of the "source files" on a network folder.

I've finally taken the time to create a Docker image that makes setup a breeze. I've used Docker before but this is my first time creating a "recipe" -- it took a lot of trial and error to avoid some of the setup gotchas.

The image is here for your docker pull if you want to try it:

https://hub.docker.com/repository/docker/cjdinger/khoros-sdk

I also shared the original Dockerfile on GitHub because...well...it's my first one of these and who knows what I screwed up. If you know better, you might have a shot at fixing it.

Success! Built my community plugin in Docker.

I use VS Code on my local host machine to maintain the source files. I also use git (we use GitLab) for source control from within Windows (PowerShell). I use this new Docker container only when I need to run the li commands to build and submit the plugin to our stage environment.

3 Replies

  • Nice work! I had tried to get a working Docker image put together for the SDK a while back, but couldn't quite get as far as you. I suspect the magic ingredient that you found that I missed is:

    # this backlevel version of nodejs is supported in the SDK
    RUN curl -sL https://rpm.nodesource.com/setup_8.x | bash -

     

  • cjdinger's avatar
    cjdinger
    Leader
    4 years ago

    That was definitely one of the gotchas cgrinton.  The other was the confusing error about being unable to create some install directories. (I saw another member struggled with this issue.) I solved that by creating a different location to install the nodejs apps with npm, and setting the environment variable to redirect before running the install for gulp and lithium-sdk.

    # set a location to install these node apps
    RUN mkdir /home/sdkuser/.npm-global
    ENV NPM_CONFIG_PREFIX=/home/sdkuser/.npm-global

    It would be nice if Khoros support or services decided to create an "official" Docker image for SDK users that they could keep current as the SDK gets versioned (which is infrequent, I know). Happy to donate my Dockerfile to the cause as a start.