Giter Site home page Giter Site logo

circleci-public / cimg-clojure Goto Github PK

View Code? Open in Web Editor NEW
3.0 13.0 4.0 67 KB

The Next-Gen CircleCI Clojure Docker Convenience Image.

Home Page: https://circleci.com/developer/images/image/cimg/clojure

License: MIT License

Dockerfile 93.48% Shell 6.52%
convenience-image circleci-cimg cimg circleci clojure

cimg-clojure's Introduction

CircleCI Logo Docker Logo Clojure Logo

CircleCI Convenience Images => Clojure

A Continous Integration focused Clojure Docker image built to run on CircleCI

CircleCI Build Status Software License Docker Pulls CircleCI Community

This image is designed to supercede the original CircleCI Clojure image, circleci/clojure.

cimg/clojure is a Docker image created by CircleCI with continuous integration builds in mind. Each tag contains a Clojure version, a JVM, and any binaries and tools that are required for builds to complete successfully in a CircleCI environment.

Support Policy

The CircleCI Docker Convenience Image support policy can be found on the CircleCI docs site. This policy outlines the release, update, and deprecation policy for CircleCI Docker Convenience Images.

Table of Contents

Getting Started

This image can be used with the CircleCI docker executor. For example:

jobs:
  build:
    docker:
      - image: cimg/clojure:1.10.3
    steps:
      - checkout
      - run: lein version

In the above example, the CircleCI Clojure Docker image is used for the primary container. More specifically, the tag 1.10.3 is used meaning the version of Clojure will be Clojure v1.10.3. You can now use Clojure within the steps for this job.

How This Image Works

This image contains the Clojure programming language as installed via clj as well as Leiningen. These Clojure images contain OpenJDK v17 though alternates with support for OpenJDK v8 (and possibly) more are in the works..

Babashka is pre-installed. Please note that Babashka has frequent releases while CircleCI only releases Clojure images as the upstream project makes a release. There will be times were the pre-installed version of Babashka is older than you might want.

Parent Tags and Parent Slugs

Parent Tags introduce the ability to choose a specific version to include in the tag. In conjunction with the Parent Slug, Clojure now supports choosing which OpenJDK version to use and looks like: parentSlug-parentTag, which would translate to openjdk-8.0

Variants

Variant images typically contain the same base software, but with a few additional modifications.

Node.js

The Node.js variant is the same Clojure image but with Node.js also installed. The Node.js variant can be used by appending -node to the end of an existing cimg/clojure tag.

jobs:
  build:
    docker:
      - image: cimg/clojure:1.10.3-node
    steps:
      - checkout
      - run: node --version

Browsers

The browsers variant is the same Clojure image but with Node.js, Selenium, and browser dependencies pre-installed via apt. The browsers variant can be used by appending -browser to the end of an existing cimg/clojure tag. The browsers variant is designed to work in conjunction with the CircleCI Browser Tools orb. You can use the orb to install a version of Google Chrome and/or Firefox into your build. The image contains all of the supporting tools needed to use both the browser and its driver.

orbs:
  browser-tools: circleci/[email protected]
jobs:
  build:
    docker:
      - image: cimg/clojure:1.10.3-browsers
    steps:
      - browser-tools/install-browser-tools
      - checkout
      - run: |
          node --version
          google-chrome --version

Tagging Scheme

This image has the following tagging scheme:

cimg/clojure:<clojure-version>[-openjdk-version][-variant]

<clojure-version> - The version of Clojure to use. This can be a full SemVer point release (such as 1.10.1) or just the minor release (such as 1.10). If you use the minor release tag, it will automatically point to future patch updates as they are released by the Clojure Team. For example, the tag 1.10 points to Clojure v1.10.1 now, but when the next release comes out, it will point to Clojure v1.10.2.

<openjdk-version> - This specifies the openjdk version to use. Note: the default image tag: cimg/clojure:<clojure-version>[-variant] will utilize the latest version e.g 17.0

[-variant] - Variant tags, if available, can optionally be used. Once the Node.js variant is available, it could be used like this: cimg/clojure:1.10-node.

Development

Images can be built and run locally with this repository. This has the following requirements:

  • local machine of Linux (Ubuntu tested) or macOS
  • modern version of Bash (v4+)
  • modern version of Docker Engine (v19.03+)

Cloning For Community Users (no write access to this repository)

Fork this repository on GitHub. When you get your clone URL, you'll want to add --recurse-submodules to the clone command in order to populate the Git submodule contained in this repo. It would look something like this:

git clone --recurse-submodules <my-clone-url>

If you missed this step and already cloned, you can just run git submodule update --recursive to populate the submodule. Then you can optionally add this repo as an upstream to your own:

git remote add upstream https://github.com/CircleCI-Public/cimg-clojure.git

Cloning For Maintainers ( you have write access to this repository)

Clone the project with the following command so that you populate the submodule:

git clone --recurse-submodules [email protected]:CircleCI-Public/cimg-clojure.git

Generating Dockerfiles

Dockerfiles can be generated for a specific Clojure version using the gen-dockerfiles.sh script. For example, to generate the Dockerfile for Clojure v1.10.1, you would run the following from the root of the repo:

./shared/gen-dockerfiles.sh 1.10.3#1.10.3.1058

This is the Clojure version 1.10.3 followed by a version parameter, which is the Clojure number together with the build number, 1.10.3.1058. You can get the current build number from the Linux Install Instructions for Clojure. It's the last part of the version in the example on that page.

The generated Dockerfile will be located at ./1.10/<parent-tag>/Dockefile in addition to their corresponding variants located at ./1.10/<parent-tag>/<variant>/Dockefile

To build this image locally and try it out, you can run the following (assuming openjdk 8.0):

cd 1.10
docker build -t test/clojure:1.10.1-openjdk-8.0 .
docker run -it test/clojure:1.10.1-openjdk-8.0 bash

If using the default version (latest), you could run either of the following:

cd 1.10
docker build -t test/clojure:1.10.1 .
docker run -it test/clojure:1.10.1 bash

docker build -t test/clojure:1.10.1-openjdk-17.0 .
docker run -it test/clojure:1.10.1-openjdk-17.0 bash

Building the Dockerfiles

To build the Docker images locally as this repository does, you'll want to run the build-images.sh script:

./build-images.sh

This would need to be run after generating the Dockerfiles first. When releasing proper images for CircleCI, this script is run from a CircleCI pipeline and not locally.

Publishing Official Images (for Maintainers only)

The individual scripts (above) can be used to create the correct files for an image, and then added to a new git branch, committed, etc. A release script is included to make this process easier. To make a proper release for this image, lets's use the fake Clojure version of Clojure v9.9.9, you would run the following from the repo root:

./shared/release.sh 9.9.9#9.9.9.1234

Here the fake Clojure version 9.9.9 is used followed by a version parameter, which is the fake Clojure number together with the fake build number, 9.9.9.1234. You can get the current build number from the Linux Install Instructions for Clojure. It's the last part of the version in the example on that page.

This will automatically create a new Git branch, generate the Dockerfile(s), stage the changes, commit them, and push them to GitHub. All that would need to be done after that is:

  • wait for build to pass on CircleCI
  • review the PR
  • merge the PR

The main branch build will then publish a release.

Incorporating Changes

How changes are incorporated into this image depends on where they come from.

build scripts - Changes within the ./shared submodule happen in its own repository. For those changes to affect this image, the submodule needs to be updated. Typically like this:

cd shared
git pull
cd ..
git add shared
git commit -m "Updating submodule for foo."

parent image - By design, when changes happen to a parent image, they don't appear in existing Clojure images. This is to aid in "determinism" and prevent breaking customer builds. New Clojure images will automatically pick up the changes.

If you really want to publish changes from a parent image into the Clojure image, you have to build a specific image version as if it was a new image. This will create a new Dockerfile and once published, a new image.

Clojure specific changes - Editing the Dockerfile.template file in this repo is how to modify the Clojure image specifically. Don't forget that to see any of these changes locally, the gen-dockerfiles.sh script will need to be run again (see above).

Contributing

We encourage issues and pull requests against this repository.

Please check out our contributing guide which outlines best practices for contributions and what you can expect from the images team at CircleCI.

Additional Resources

CircleCI Docs - The official CircleCI Documentation website.
CircleCI Configuration Reference - From CircleCI Docs, the configuration reference page is one of the most useful pages we have. It will list all of the keys and values supported in .circleci/config.yml.
Docker Docs - For simple projects this won't be needed but if you want to dive deeper into learning Docker, this is a great resource.

License

This repository is licensed under the MIT license. The license can be found here.

cimg-clojure's People

Contributors

bytesguy avatar felicianotech avatar jalexchen avatar joshhsoj1902 avatar mrothstein74 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cimg-clojure's Issues

Not getting the latest version of Nodejs

Troubleshooting some test failures when using the cimg/clojure:1.11-openjdk-11.0-browsers image led to discovering that the version of Nodejs is quite old

~/app $ node -v
v12.10.0

It looks like the image should download the latest LTS version based on the ALIASES file in cimg-node

NODE_VERSION=$(grep "lts" ./nodeAliases.txt | cut -d "=" -f 2-) && \

However, the version currently in that file (v16) does not match what's installed.

Feature Request: arm64 support

Describe the Feature Request
Add arm64 support.

Currently errors with this message:

Status: Downloaded newer image for cimg/clojure:1.11.1
WARNING: docker image cimg/clojure:1.11.1 targets wrong architecture (found amd64 but need [arm64 arm64v8 arm32v7 arm32v6])

Is your feature request related to a particular problem?
Add support for arm64 with docker executors

How will this feature request benefit CircleCI jobs using this image?
Enable resource_type to be used for arm64

[bug report]

Unable to use checkout command due to the following error:

Directory (/home/circleci/project) you are trying to checkout to is not empty and not a git repository

image used:

cimg/clojure:1.10
cimg/clojure@sha256:b1e9fd2afba5fe38743550f45fee1baf8ffc65307a4c44c818fc7ec62661fb3d

SSHing into the job (which fails at checkout which is the first step), I can see there does appear to be a file in that directory.

~/project/target/stale/leiningen.core.classpath.extract-native-dependencies

It seems these paths and the file within must be removed or relocated.

JDK 21 (LTS)

JDK 21 (LTS) has been recently released. It would be greatly appreciated to have it here.

Thanks - V

Clojure image with Java 8

Hi,

I noticed #13 was closed. I followed the instructions in the readme with the parentSlug-parentTag but it looks like the java 8 cimg is not available or I'm doing something wrong?

I get this error

Error response from daemon: manifest for cimg/clojure:1.10.1-openjdk-8.0 not found: manifest unknown: manifest unknown

and trying to reference the image as

docker: 
   - image: cimg/clojure:1.10.1-openjdk-8.0

build-images.sh fails

Hi,
thanks for this. I wanted to build an image based on this one but when I cloned your repository I failed building it. There is an error while verifying. I can verify when running the commands locally though.

The output on my machine is

timo@keend> ./build-images.sh                                                                   ~/projects/cimg-clojure
Sending build context to Docker daemon  14.75MB
Step 1/7 : FROM cimg/openjdk:11.0
 ---> 0fddcc37a1f4
Step 2/7 : LABEL maintainer="Community & Partner Engineering Team <[email protected]>"
 ---> Using cache
 ---> 9a4445eae0b1
Step 3/7 : ENV LEIN_VERSION=2.9.1
 ---> Using cache
 ---> 98712bd704ed
Step 4/7 : RUN sudo curl -sSL -o /usr/local/bin/lein "https://raw.githubusercontent.com/technomancy/leiningen/${LEIN_VERSION}/bin/lein-pkg" && 	sudo chmod +x /usr/local/bin/lein && 	curl -sSL -O "https://github.com/technomancy/leiningen/releases/download/${LEIN_VERSION}/leiningen-${LEIN_VERSION}-standalone.zip" && 	curl -sSL -O "https://github.com/technomancy/leiningen/releases/download/${LEIN_VERSION}/leiningen-${LEIN_VERSION}-standalone.zip.asc" && 	mkdir -p ~/.gnupg && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf && 	gpg --batch --keyserver pool.sks-keyservers.net --recv-key 2B72BF956E23DE5E830D50F6002AF007D1A7CC18 && 	echo "Verifying Jar file signature ..." && 	gpg --verify leiningen-$LEIN_VERSION-standalone.zip.asc && 	rm leiningen-$LEIN_VERSION-standalone.zip.asc && 	sudo mkdir -p /usr/share/java && 	sudo mv leiningen-$LEIN_VERSION-standalone.zip /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar
 ---> Running in 82decf97c599
+ sudo curl -sSL -o /usr/local/bin/lein https://raw.githubusercontent.com/technomancy/leiningen/2.9.1/bin/lein-pkg
+ sudo chmod +x /usr/local/bin/lein
+ curl -sSL -O https://github.com/technomancy/leiningen/releases/download/2.9.1/leiningen-2.9.1-standalone.zip
+ curl -sSL -O https://github.com/technomancy/leiningen/releases/download/2.9.1/leiningen-2.9.1-standalone.zip.asc
+ mkdir -p /home/circleci/.gnupg
+ echo disable-ipv6
+ gpg --batch --keyserver pool.sks-keyservers.net --recv-key 2B72BF956E23DE5E830D50F6002AF007D1A7CC18
gpg: WARNING: unsafe permissions on homedir '/home/circleci/.gnupg'
gpg: keybox '/home/circleci/.gnupg/pubring.kbx' created
gpg: key 002AF007D1A7CC18: 3 signatures not checked due to missing keys
gpg: /home/circleci/.gnupg/trustdb.gpg: trustdb created
gpg: key 002AF007D1A7CC18: public key "Phil Hagelberg <[email protected]>" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg:               imported: 1
Verifying Jar file signature ...
+ echo 'Verifying Jar file signature ...'
+ gpg --verify leiningen-2.9.1-standalone.zip.asc
gpg: WARNING: unsafe permissions on homedir '/home/circleci/.gnupg'
gpg: assuming signed data in 'leiningen-2.9.1-standalone.zip'
gpg: Signature made Fri 14 Feb 2020 09:40:05 PM UTC
gpg:                using RSA key 20242BACBBE95ADA22D0AFD7808A33D379C806C3
gpg: Can't check signature: No public key
The command '/bin/bash -exo pipefail -c sudo curl -sSL -o /usr/local/bin/lein "https://raw.githubusercontent.com/technomancy/leiningen/${LEIN_VERSION}/bin/lein-pkg" && 	sudo chmod +x /usr/local/bin/lein && 	curl -sSL -O "https://github.com/technomancy/leiningen/releases/download/${LEIN_VERSION}/leiningen-${LEIN_VERSION}-standalone.zip" && 	curl -sSL -O "https://github.com/technomancy/leiningen/releases/download/${LEIN_VERSION}/leiningen-${LEIN_VERSION}-standalone.zip.asc" && 	mkdir -p ~/.gnupg && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf && 	gpg --batch --keyserver pool.sks-keyservers.net --recv-key 2B72BF956E23DE5E830D50F6002AF007D1A7CC18 && 	echo "Verifying Jar file signature ..." && 	gpg --verify leiningen-$LEIN_VERSION-standalone.zip.asc && 	rm leiningen-$LEIN_VERSION-standalone.zip.asc && 	sudo mkdir -p /usr/share/java && 	sudo mv leiningen-$LEIN_VERSION-standalone.zip /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar' returned a non-zero code: 2

Suggestion for variants based on Java 8, 11 and 17

Request from customer:

Variants of the image that are based on Java 8, 11, and 17 would be really useful for us, as unfortunately we have some other components that we need to run in the container that still need Java 8. And we’d like to avoid having to maintain our own image if possible!

Respin clojure

Default ParentTag functionality did not push the default Tags in the last respin; it was only tagged. Will need to update submodules then re-run the gen-dockerfiles script

Suggestion: add babashka in the base image

I believe many Clojure users are starting to use babashka as a replacement for makefile (by using tasks) and as a scripting language. The cost however would be an image bigger of 80 MB.

I think it would make a great addition for this image.

Update Clojure 1.11.1 build

Would it be possible to update this to use a newer build of Clojure?

cimg/clojure:1.11.1 and cimg/clojure:1.11.1-openjdk-17.0 are both using Clojure 1.11.1.1105
https://github.com/CircleCI-Public/cimg-clojure/blob/main/1.11/Dockerfile#L12

However, I am seeing sporadic build errors in circleci due to a bug in Clojure. The bug appears to have been fixed in Clojure 1.11.1.1113 https://clojure.org/releases/tools#v1.11.1.1113

FWIW the exception I am seeing is

Error building classpath. class java.util.HashMap$Node cannot be cast to class java.util.HashMap$TreeNode (java.util.HashMap$Node and java.util.HashMap$TreeNode are in module java.base of loader 'bootstrap')
java.lang.ClassCastException: class java.util.HashMap$Node cannot be cast to class java.util.HashMap$TreeNode (java.util.HashMap$Node and java.util.HashMap$TreeNode are in module java.base of loader 'bootstrap')
	at java.base/java.util.HashMap$TreeNode.moveRootToFront(HashMap.java:1986)
	at java.base/java.util.HashMap$TreeNode.treeify(HashMap.java:2102)
	at java.base/java.util.HashMap.treeifyBin(HashMap.java:770)
	at java.base/java.util.HashMap.putVal(HashMap.java:642)
	at java.base/java.util.HashMap.put(HashMap.java:610)
	at java.base/java.util.HashSet.add(HashSet.java:221)
	at org.apache.maven.model.validation.DefaultModelValidator.validateId(DefaultModelValidator.java:848)
	at org.apache.maven.model.validation.DefaultModelValidator.validateEffectiveDependency(DefaultModelValidator.java:663)
	at org.apache.maven.model.validation.DefaultModelValidator.validateEffectiveDependencies(DefaultModelValidator.java:584)
	at org.apache.maven.model.validation.DefaultModelValidator.validateEffectiveModel(DefaultModelValidator.java:374)
	at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:501)
	at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:437)
	at org.apache.maven.model.building.DefaultModelBuilder.importDependencyManagement(DefaultModelBuilder.java:1306)
	at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:481)
	at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:437)
	at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:252)
	at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:297)
	at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:175)
	at org.eclipse.aether.internal.impl.DefaultRepositorySystem.readArtifactDescriptor(DefaultRepositorySystem.java:255)
	at clojure.tools.deps.alpha.extensions.maven$read_descriptor.invokeStatic(maven.clj:115)
	at clojure.tools.deps.alpha.extensions.maven$fn__1128.invokeStatic(maven.clj:143)
	at clojure.tools.deps.alpha.extensions.maven$fn__1128.invoke(maven.clj:143)
	at clojure.lang.MultiFn.invoke(MultiFn.java:244)
	at clojure.tools.deps.alpha$expand_deps$children_task__771$fn__773$fn__774.invoke(alpha.clj:405)
	at clojure.tools.deps.alpha.util.concurrent$submit_task$task__479.invoke(concurrent.clj:35)
	at clojure.lang.AFn.call(AFn.java:18)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)

1.11.1.1113 has a fix for the issue with maven

thanks!

Image outdated

Will this image be updated some time? Clojure is now in 1.10.3 while this image is still in 1.10.1

Add JAVA_HOME/bin to PATH

One gotcha I found migrating from the circleci/clojure images to the images in this repo is that JAVA_HOME/bin isn't added to PATH, which makes a lot of our scripts that try to run e.g. jar fails.

We have a workaround, but it seems easy enough for backward compat to add it.

"Orb-less" images to ensure feature compatibility with `circleci/clojure`

The old circleci/clojure images with the -browsers variation had chrome (and other browsers) installed, ready to go.

These new images make use of CircleCI Orbs, making them impractical for usage outside of CircleCI.

Another thing:
A common use case is running CLJS unit tests with Karma, requiring headless browsers, but not selenium.

So maybe additional following tags would be a good addition?

-browser-chrome                ; with chrome installed
-browser-chrome-selenium       ; with chrome + selenium installed

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.