How to emulate ENTRYPOINT?


#1

I inherited a Dockerfile that looked like this (but with older deps).
I tried to update it and put it onto docker hub and then link to it from my CI script, but… it was all too complicated

FROM node:8.12.0

MAINTAINER .... <hotbelgo@gmail.com>

RUN yarn global add elm@0.19.0-bugfix2 \
 && yarn global add elm-test@0.19.0-beta9

ENTRYPOINT ["elm"]

So I thought plan B would be to add the yarn installs to my CI file. That seems to be working but then the script fails saying elm can’t be found. I guess that was handled by the ENTRYPOINT command so my question is how to add that to ci

# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2
jobs:
  build:
    docker:
      # specify the version you desire here
      - image: node:8.12.0

      # Specify service dependencies here if necessary
      # CircleCI maintains a library of pre-built images
      # documented at https://circleci.com/docs/2.0/circleci-images/
      # - image: circleci/mongo:3.4.4

    working_directory: ~/repo

    steps:
      - checkout

      # Download and cache dependencies
      - restore_cache:
          keys:
          - v1-dependencies-{{ checksum "package.json" }}
          # fallback to using the latest cache if no exact match is found
          - v1-dependencies-

      - run: npm install && yarn global add elm@0.19.0-bugfix2 && yarn global add elm-test@0.19.0-beta9

      - save_cache:
          paths:
            - node_modules
          key: v1-dependencies-{{ checksum "package.json" }}

      # run tests!
      - run: npm run test

It looks as though I am supposed to add entrypoint in the docker section, but’s before elm has been installed


#2

I would suggest creating a new CI build just to produce your Docker image, and once built that can push the image to a public or private registry of your choice.

Then the config you show above can use an image that points to the custom image, rather than the standard one. Private registries are supported here, as long as you provide the credentials to pull from it - see the docs.


#3

A Docker entrypoint is simply what command to run. Elm needs to be installed.

Looking at your CircleCI config, I have two suggestions to start with.

  1. Use sudo when installing something globally.
  2. Pick one - npm or yarn. Don’t use both in the same build, it can cause problems.

#4

Thanks - I have made some progress based on this


#5

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.