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

Need help to run custom entrypoint script #1493

Open
telemat opened this issue Feb 1, 2022 · 1 comment
Open

Need help to run custom entrypoint script #1493

telemat opened this issue Feb 1, 2022 · 1 comment
Labels
docker documentation Documentation should be extended or updated

Comments

@telemat
Copy link

telemat commented Feb 1, 2022

I have a service with two main classes, one for migrations and the other for the actual service. The two bash/bat files are generated, but I need a custom entrypoint script to call both scripts (to perform migrations first and then to run the service).

My docker settings are as follows:

Docker / organizationName := organization.value
Docker / packageName      := s"${organization.value}/${name.value}"
Docker / maintainer       := "Yours truly"
Docker / version          := version.value
Docker / daemonUserUid    := None
Docker / daemonUser       := "daemon"

// https://hub.docker.com/_/eclipse-temurin/
dockerBaseImage := "eclipse-temurin:11-jre-focal"
dockerExposedPorts ++= Seq(8888)

Docker / dockerPackageMappings += (baseDirectory.value / "docker" / "docker-entrypoint.sh" -> "docker-entrypoint.sh")

This is the generated Dockerfile

FROM eclipse-temurin:11-jre-focal@sha256:e46fac3005d08732931de9671864683f6adf3a3eb0f8a7e8ac27d1bff1955a5c as stage0
LABEL snp-multi-stage="intermediate"
LABEL snp-multi-stage-id="d4ace394-8637-4624-a351-9d3a478c36cd"
WORKDIR /opt/docker
COPY 1/opt /1/opt
COPY 2/opt /2/opt
COPY 4/opt /4/opt
COPY opt /opt
USER root
RUN ["chmod", "-R", "u=rX,g=rX", "/1/opt/docker"]
RUN ["chmod", "-R", "u=rX,g=rX", "/2/opt/docker"]
RUN ["chmod", "-R", "u=rX,g=rX", "/4/opt/docker"]
RUN ["chmod", "-R", "u=rX,g=rX", "/opt/docker"]
RUN ["chmod", "u+x,g+x", "/4/opt/docker/bin/scala-refi-service"]
RUN ["chmod", "u+x,g+x", "/4/opt/docker/bin/migrations"]
RUN ["chmod", "u+x,g+x", "docker-entrypoint.sh"]

FROM eclipse-temurin:11-jre-focal@sha256:e46fac3005d08732931de9671864683f6adf3a3eb0f8a7e8ac27d1bff1955a5c as mainstage
LABEL MAINTAINER="Yours truly"
WORKDIR /opt/docker
COPY --from=stage0 --chown=daemon:root /1/opt/docker /opt/docker
COPY --from=stage0 --chown=daemon:root /2/opt/docker /opt/docker
COPY --from=stage0 --chown=daemon:root /4/opt/docker /opt/docker
COPY --from=stage0 --chown=daemon:root /opt/docker /opt/docker
EXPOSE 8888
USER daemon
ENTRYPOINT ["/opt/docker/bin/scala-refi-service"]
CMD []

The contents of the docker/stage folder are:

1 - folder
2 - folder
4 - folder
docker-entrypoint.sh - file
Dockerfile - file

I'm getting the following error upon doing docker:publishLocal

[error] #10 ERROR: "/opt" not found: not found
[error] ------
[error]  > [stage0  6/13] COPY opt /opt:
[error] ------

Without the setting Docker / dockerPackageMappings += (baseDirectory.value / "docker" / "docker-entrypoint.sh" -> "docker-entrypoint.sh") everything works fine but I can't override the entrypoint.

Is there any example that I can refer to for using a custom script as entrypoint?

@muuki88 muuki88 added docker documentation Documentation should be extended or updated labels Jan 30, 2023
@muuki88
Copy link
Contributor

muuki88 commented Jan 30, 2023

I would recommend putting the stuff in src/universal, where it's being picked up automatically. Hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docker documentation Documentation should be extended or updated
Projects
None yet
Development

No branches or pull requests

2 participants