Skip to content

Commit

Permalink
Add dockerfile from scalameta#1829
Browse files Browse the repository at this point in the history
  • Loading branch information
Olafur Pall Geirsson committed Mar 30, 2020
1 parent 8f0ca52 commit 944cc2b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM openjdk:8

This comment has been minimized.

Copy link
@bsolomon1124

bsolomon1124 Mar 31, 2020

I think that a multi-stage build might be possible here and could drastically reduce the image size. But I'm not certain about that since I don't know scalafmt well enough. Example: https://github.com/hadolint/hadolint/blob/master/docker/Dockerfile.

One other suggestion would be to put the Dockerfile in docker/Dockerfile rather than at the project root.
That will help avoid the common pitfall of sending a ton of files as part of the build context if they use, for instance, docker build .

This comment has been minimized.

Copy link
@olafurpg

olafurpg Mar 31, 2020

Owner

Thanks for the review! I just copy-pasted your dockerfile from the issue. It's best if you can open a PR adding the dockerfile that meets your needs. I don't have a strong opinion on the details (I'm not so familiar with Docker). I'm open to discuss how to keep the dockerhub image updated with the latest Scalafmt releases

This comment has been minimized.

Copy link
@bsolomon1124

bsolomon1124 Mar 31, 2020

Got it. Yes, the original Dockerfile I posted on the GH Issue was definitely a rough draft. I'll open a PR.

ARG SCALAFMT_VERSION=2.4.2
ARG SCALAFMT_INSTALL_LOCATION=/usr/local/bin/scalafmt
RUN set -ex \
&& apt-get update -y \
&& rm -rf /var/lib/apt/lists/* \
&& echo insecure > "$HOME/.curlrc" \

This comment has been minimized.

Copy link
@bsolomon1124

bsolomon1124 Mar 31, 2020

echo insecure > "$HOME/.curlrc"

This line should probably be removed; I added it as a function of lacking TLS certs on my Docker host, but I would venture to guess most people have them. At the very most it might require adding apt-get install -y --no-install-recommends ca-certificates=*.

&& curl -Lo coursier https://git.io/coursier-cli \

This comment has been minimized.

Copy link
@bsolomon1124

bsolomon1124 Mar 31, 2020

Two thoughts:

  1. Is there a difference between https://git.io/coursier-cli and https://git.io/coursier-cli-linux? Maybe one 301-redirects?
  2. Wondering if Coursier publishes keys that we could use for gpg verification. (example)
&& chmod u+x coursier \
&& ./coursier bootstrap "org.scalameta:scalafmt-cli_2.12:$SCALAFMT_VERSION" \
-r sonatype:snapshots \
-o "$SCALAFMT_INSTALL_LOCATION" \
--main org.scalafmt.cli.Cli \
&& rm -f coursier \
&& scalafmt --version
CMD ["/usr/local/bin/scalafmt"]

0 comments on commit 944cc2b

Please sign in to comment.