Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

325
Vistas
How to add custom commands in Dockerfile for sbt plugin

When I do sbt docker:publishLocal, it creates a Dockerfile automatically erasing previous content of the file.

I wanted to add custom commands to add cassandra to the container. I copy pasted the content of this file

https://github.com/docker-library/cassandra/blob/064fb4e2682bf9c1909e4cb27225fa74862c9086/3.11/Dockerfile

and tried to run above command again. But that wipes out all existing content and replace it with default content.

How can I add docker commands in Dockerfile or build.sbt?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

The sbt-docker plugin has a customization section, including one "Write from Scratch", which could be of interest:

You can simply wipe out all docker commands with

dockerCommands := Seq()

Now let’s start adding some Docker commands.

import com.typesafe.sbt.packager.docker._

dockerCommands := Seq(
  Cmd("FROM", "openjdk:8"),
  Cmd("LABEL", s"""MAINTAINER="${maintainer.value}""""),
  ExecCmd("CMD", "echo", "Hello, World from Docker")
)

You can write your custom Dockerfile that way: it will be correctly regenerated.

How am I going to add something like this:

 RUN set -x \ 
     && apt-get update && apt-get install -y --no-install-recommends ca-certificates wget && rm -rf /var/lib/apt/lists/* \ 
     && wget -O /usr/local/bin/gosu.... 

As in the example from the documentation:

ExecCmd("RUN",
    "set", "-x",
     "&&",
     "apt-get", "update", ...
),
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda