i am using docker sbt plugin to docerkize my app i am using selenium for testing and for that i have instaled firefox in my container when i run the image i got the exception
Sep 23, 2023 11:09:09 AM org.openqa.selenium.remote.RemoteWebDriver checkNonW3CCapabilities
notary-container | WARNING: Support for Legacy Capabilities is deprecated; You are sending the following invalid capabilities: [acceptSslCerts, javascriptEnabled]; Please update to W3C Syntax: https://www.selenium.dev/blog/2022/legacy-protocol-support/
notary-container | 1695467349437 geckodriver INFO Listening on 127.0.0.1:44693
notary-container | 1695467350014 mozrunner::runner INFO Running command: MOZ_CRASHREPORTER="1" MOZ_CRASHREPORTER_NO_REPORT="1" MOZ_CRASHREPORTER_SHUTDOWN="1" MOZ_NO_REMOTE="1" "/usr ... s" "http://127.0.0.1:43181/,http://localhost:43181/,http://[::1]:43181/" "-no-remote" "-profile" "/tmp/rust_mozprofilePg9SUa"
notary-container | Error: no DISPLAY environment variable specified
after some research i found this solution RUN apt-get -qy --no-install-recommends install xvfb
RUN set -e
RUN echo "Starting X virtual framebuffer (Xvfb) in background..."
RUN Xvfb -ac :99 -screen 0 1280x1024x16 > /dev/null 2>&1 &
RUN export DISPLAY=:99
RUN exec "$@"
i have added these here is my build.sbt
dockerCommands ++= Seq(
ExecCmd("RUN", "apk", "add", "bash"),
ExecCmd("RUN", "apk", "update"),
ExecCmd("RUN", "apk","add", "firefox-esr"),
ExecCmd("RUN", "apk","add","xvfb"),
//ExecCmd("RUN", "set","-e"),
ExecCmd("RUN", "echo","Starting X virtual framebuffer (Xvfb) in background.."),
ExecCmd("RUN", "Xvfb","-ac",":99", "-screen", "0", "1280x1024x16", ">", "/dev/null", "2>&1", "&"),
ExecCmd("RUN", "export","DISPLAY=:99"),
ExecCmd("RUN", "exec","\"$@\"")
)
and here is generated dockerfile
FROM amazoncorretto:11-alpine3.18-jdk
WORKDIR /opt/docker
COPY --chown=root:root opt /opt
EXPOSE 8083
USER root
ENTRYPOINT ["/opt/docker/bin/notary-scraping"]
CMD []
RUN ["apk", "add", "bash"]
RUN ["apk", "update"]
RUN ["apk", "add", "firefox-esr"]
RUN ["apk", "add", "xvfb"]
RUN ["Xvfb", "-ac", ":99", "-screen", "0", "1280x1024x16 > /dev/null 2>&1 &"]
RUN ["export", "DISPLAY=:99"]
when i run docker:publishlocal it just hangs on this step
ExecCmd("RUN", "Xvfb","-ac",":99", "-screen", "0", "1280x1024x16 > /dev/null 2>&1 &"),
0 building with "default" instance using docker driver
[error] #1 [internal] load .dockerignore
[error] #1 transferring context: 2B done
[error] #1 DONE 0.0s
[error] #2 [internal] load build definition from Dockerfile
[error] #2 transferring dockerfile: 423B done
[error] #2 DONE 0.0s
[error] #3 [internal] load metadata for docker.io/library/amazoncorretto:11-alpine3.18-jdk
[error] #3 DONE 0.8s
[error] #4 [1/9] FROM docker.io/library/amazoncorretto:11-alpine3.18-jdk@sha256:ccdb5a6fe5cebb461ae2e20a9c717c034313586477227dc56bcd1da9402edbdb
[error] #4 DONE 0.0s
[error] #5 [internal] load build context
[error] #5 transferring context: 17.02kB 0.0s done
[error] #5 DONE 0.0s
[error] #6 [5/9] RUN ["apk", "update"]
[error] #6 CACHED
[error] #7 [4/9] RUN ["apk", "add", "bash"]
[error] #7 CACHED
[error] #8 [2/9] WORKDIR /opt/docker
[error] #8 CACHED
[error] #9 [3/9] COPY --chown=root:root opt /opt
[error] #9 CACHED
[error] #10 [6/9] RUN ["apk", "add", "firefox-esr"]
[error] #10 CACHED
[error] #11 [7/9] RUN ["apk", "add", "xvfb"]
[error] #11 CACHED
[error] #12 [8/9] RUN ["Xvfb", "-ac", ":99", "-screen", "0", "1280x1024x16 > /dev/null 2>&1 &"]
how can i resolve this issue ?