Skip to content
This repository has been archived by the owner on Feb 25, 2022. It is now read-only.

Commit

Permalink
Simplify installs; Adjust docs
Browse files Browse the repository at this point in the history
  • Loading branch information
JannikArndt committed Oct 31, 2019
1 parent 886f76d commit dfcfec9
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 24 deletions.
26 changes: 14 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,33 @@
# - AWS CLI
# - kubectl
# - sonar-scanner
# - Java 8 JDK (from base image)
# - SBT (from base image)
# - SBT (overwrites base image with newer version)
# - Java 11.0.X JDK (from base image)
# - Docker (from base image)

# Pull base image (https://circleci.com/docs/2.0/circleci-images/#openjdk)
# https://github.com/CircleCI-Public/circleci-dockerfiles/blob/master/openjdk/images/8u232-jdk/Dockerfile
FROM circleci/openjdk:11.0.5-jdk-stretch
FROM circleci/openjdk:11-jdk-stretch

# Environment variables
ENV SCALA_VERSION=2.13.1
ENV KUBECTL_VERSION=v1.16.1
ENV SBT_VERSION=1.3.3
ENV SONAR_SCANNER_VERSION=3.3.0.1492
ENV SONAR_SCANNER_PACKAGE=sonar-scanner-cli-${SONAR_SCANNER_VERSION}.zip

USER root

SHELL ["/bin/bash", "-eo", "pipefail", "-x", "-c"]

# Fix apt-get
RUN apt-get update && apt-get install -y apt-transport-https

# Install current SBT
RUN apt-get update && apt-get install apt-transport-https
RUN echo "deb https://dl.bintray.com/sbt/debian /" | tee -a /etc/apt/sources.list.d/sbt.list
RUN curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | apt-key add
RUN apt-get update && apt-get install sbt
RUN mkdir project && echo "sbt.version=1.3.3" > project/build.properties && echo "scalaVersion := \"2.13.1\"" > build.sbt
RUN sbt sbtVersion
RUN echo "scalaVersion := \"$SCALA_VERSION\"" > build.sbt
RUN sbt sbtVersion scalaVersion -Dsbt.version=$SBT_VERSION

# Install the AWS CLI
RUN curl -sSL https://s3.amazonaws.com/aws-cli/awscli-bundle.zip -o awscli-bundle.zip && \
Expand All @@ -38,10 +40,10 @@ RUN curl -sSL https://s3.amazonaws.com/aws-cli/awscli-bundle.zip -o awscli-bundl
/usr/local/bin/aws --version

# Install kubectl
RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl && \
mv kubectl /usr/local/bin/kubectl && \
chmod +x /usr/local/bin/kubectl && \
kubectl version --client
RUN curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
RUN echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list
RUN apt-get update && apt-get install -y kubectl
RUN kubectl version --client

# Install Sonar-Scanner
RUN curl -LO https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/$SONAR_SCANNER_PACKAGE && \
Expand All @@ -56,4 +58,4 @@ USER circleci
# Define working directory
WORKDIR /home/circleci

RUN echo -e "Tag for this image:\n11.0.5-${SCALA_VERSION}-${KUBECTL_VERSION}"
RUN echo -e "Tag for this image:\njava11-${SCALA_VERSION}-${SBT_VERSION}"
40 changes: 28 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,43 @@
# Dockerfile with Scala, SBT, Kubernetes, AWS CLI and Docker
# Builder image for Scala 2.13.x on JVM11

This repository contains **Dockerfile** of:
* [Scala](http://www.scala-lang.org)
* [sbt](http://www.scala-sbt.org)
* [kubectl](https://kubernetes.io/docs/reference/kubectl/overview/)
* [AWS CLI](https://aws.amazon.com/cli/)
Includes
* [Scala 2.13.x](http://www.scala-lang.org)
* [sbt 1.3.x](http://www.scala-sbt.org)
* [kubectl (latest)](https://kubernetes.io/docs/reference/kubectl/overview/)
* [AWS CLI (latest)](https://aws.amazon.com/cli/)
* [Docker](https://www.docker.com/)
* [Sonar-Scanner](https://docs.sonarqube.org/latest/)
* [Sonar-Scanner (3.3.x)](https://docs.sonarqube.org/latest/)

## Base Docker Image ##

* `circleci/openjdk:8u222-jdk-stretch` provides the JDK, SBT and Docker.
* [Dockerfile](https://github.com/CircleCI-Public/circleci-dockerfiles/blob/master/openjdk/images/8u222-jdk-stretch/Dockerfile)
* `circleci/openjdk:11-jdk-stretch` provides the JDK and Docker.
* [Dockerfile](https://github.com/CircleCI-Public/circleci-dockerfiles/blob/master/openjdk/images/11.0.5-jdk-stretch/Dockerfile)
* [background](https://circleci.com/docs/2.0/circleci-images/#openjdk)
* [Tag on Dockerhub](https://hub.docker.com/r/circleci/openjdk/tags?page=1&name=8u222-jdk-stretch)
* [Tag on Dockerhub](https://hub.docker.com/r/circleci/openjdk/tags?page=1&name=11-jdk-stretch)

## Additions ##

We add Scala (version in tag), AWS CLI (latest), Kubectl (version in tag) and Sonar-Scanner (version `3.3`).
We install and initialize `sbt` (latest 1.3.X) and `scala` (latest 2.13.X), the AWS CLI (latest), Kubectl (latest) and Sonar-Scanner (version `3.3`).

## Usage ##

If you use CircleCi, you can reference this image in your `.circleci/config.yml`:

```yaml
jobs:
build:
docker:
- image: moia/scala-on-circleci:java11
steps:
- checkout
- run: sbt compile
```

In your `build.sbt`, set `scalaVersion := "2.13.1"` and `scalacOptions := Seq("-target:11")`.

## Dockerhub ##

This image is automatically released to Dockerhub for every tag: https://hub.docker.com/r/moia/scala-on-circleci
This image is automatically released to Dockerhub for every tag: https://hub.docker.com/r/moia/scala-on-circleci/tags?page=1&name=java11

## License ##

Expand Down

0 comments on commit dfcfec9

Please sign in to comment.