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

Commit dfcfec9

Browse files
committed
Simplify installs; Adjust docs
1 parent 886f76d commit dfcfec9

File tree

2 files changed

+42
-24
lines changed

2 files changed

+42
-24
lines changed

Dockerfile

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,33 @@
33
# - AWS CLI
44
# - kubectl
55
# - sonar-scanner
6-
# - Java 8 JDK (from base image)
7-
# - SBT (from base image)
6+
# - SBT (overwrites base image with newer version)
7+
# - Java 11.0.X JDK (from base image)
88
# - Docker (from base image)
99

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

1414
# Environment variables
1515
ENV SCALA_VERSION=2.13.1
16-
ENV KUBECTL_VERSION=v1.16.1
16+
ENV SBT_VERSION=1.3.3
1717
ENV SONAR_SCANNER_VERSION=3.3.0.1492
1818
ENV SONAR_SCANNER_PACKAGE=sonar-scanner-cli-${SONAR_SCANNER_VERSION}.zip
1919

2020
USER root
2121

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

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

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

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

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

59-
RUN echo -e "Tag for this image:\n11.0.5-${SCALA_VERSION}-${KUBECTL_VERSION}"
61+
RUN echo -e "Tag for this image:\njava11-${SCALA_VERSION}-${SBT_VERSION}"

README.md

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,43 @@
1-
# Dockerfile with Scala, SBT, Kubernetes, AWS CLI and Docker
1+
# Builder image for Scala 2.13.x on JVM11
22

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

1111
## Base Docker Image ##
1212

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

1818
## Additions ##
1919

20-
We add Scala (version in tag), AWS CLI (latest), Kubectl (version in tag) and Sonar-Scanner (version `3.3`).
20+
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`).
21+
22+
## Usage ##
23+
24+
If you use CircleCi, you can reference this image in your `.circleci/config.yml`:
25+
26+
```yaml
27+
jobs:
28+
build:
29+
docker:
30+
- image: moia/scala-on-circleci:java11
31+
steps:
32+
- checkout
33+
- run: sbt compile
34+
```
35+
36+
In your `build.sbt`, set `scalaVersion := "2.13.1"` and `scalacOptions := Seq("-target:11")`.
2137

2238
## Dockerhub ##
2339

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

2642
## License ##
2743

0 commit comments

Comments
 (0)