Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce size of Docker image #19

Closed
gvolpe opened this issue Dec 3, 2019 · 2 comments · Fixed by #32
Closed

Reduce size of Docker image #19

gvolpe opened this issue Dec 3, 2019 · 2 comments · Fixed by #32
Labels
enhancement New feature or request

Comments

@gvolpe
Copy link
Owner

gvolpe commented Dec 3, 2019

Right now, the generated Docker image has 541 MBs of size, which is quite big.

Let's try to reduce it...

@gvolpe gvolpe added the enhancement New feature or request label Dec 3, 2019
@calvinlfer
Copy link

calvinlfer commented Dec 6, 2019

Hey @gvolpe, I managed to set dockerBaseImage := "azul/zulu-openjdk-alpine:8" and enabling the AshScriptPlugin to allow for alpine based images reduces the size to 105 MB. However, the following key assignment causes an NPE (since I don't have these set in my shell):

    dockerEnvVars ++= Map(
      "SC_APP_ENV" -> System.getenv("SC_APP_ENV"),
      "SC_JWT_CLAIM" -> System.getenv("SC_JWT_CLAIM"),
      "SC_JWT_SECRET_KEY" -> System.getenv("SC_JWT_SECRET_KEY"),
      "SC_PASSWORD_SALT" -> System.getenv("SC_PASSWORD_SALT"),
      "SC_ACCESS_TOKEN_SECRET_KEY" -> System.getenv("SC_ACCESS_TOKEN_SECRET_KEY"),
      "SC_ADMIN_USER_TOKEN" -> System.getenv("SC_ADMIN_USER_TOKEN")
    ),

So I removed it and I was able to build and run the container.

Is there any reason why these are explicitly specified? as should just be able to feed in the environment variables via docker run or compose

@gvolpe
Copy link
Owner Author

gvolpe commented Dec 6, 2019

No particular reason @calvinlfer , I actually need to come back to this once I start working on Chapter 9.

Last evening, there was another talk in the local Scala meetup (in Spanish) exactly about this, so I have some material :) https://slides.com/hugobellomusto/dockerizando-mi-scala-app#/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants