Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

332
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda