how to make docker image as dockerhub from source code

mikea month ago

I want to build a docker image from special version like hash:402fe83, I download the version from github, compile/build traccar-server.jar, and than how to make docker image by myself?
I download docker image traccar:latest, replace traccar-server.jar can't run,so how to build docker image from source?

Turbovixa month ago

1 - You can re-reference the official Docker documentation.
https://docs.docker.com/get-started/docker-concepts/building-images/build-tag-and-publish-an-image/

2 - You can view the official project on github and see the required layers.
https://hub.docker.com/layers/traccar/traccar/latest/images/sha256-9b60a4afbcb02abd77f5964140fe30c761a0f61c7d1fc15ca18c5e28b20846fc?context=explore

3 - Finally, create your Dockerfile with the customizations you need.

4 - See my Dockerfile

FROM debian:bookworm-slim

ENV TRACCAR_VERSION=6.5

RUN apt-get update && apt-get install -y wget unzip && rm -rf /var/lib/apt/lists/*

WORKDIR /opt/traccar

COPY traccar-linux-64-$TRACCAR_VERSION.zip /tmp/traccar.zip

RUN unzip /tmp/traccar.zip -d /opt/traccar && rm /tmp/traccar.zip

RUN chmod +x /opt/traccar/traccar.run

RUN /opt/traccar/traccar.run --quiet --accept

EXPOSE 8082

ENV TRACCAR_HOME=/opt/traccar

ENTRYPOINT ["/opt/traccar/jre/bin/java", "-Xms1g", "-Xmx1g"]

CMD ["-jar", "/opt/traccar/tracker-server.jar", "conf/traccar.xml"]