How to run own custom binary in Docker?

I have customized vikunja and provided my own little dashboard. in the future i also plan to merge it or offer it in the main repo if that makes sense. however in the meantime i like to run it on my docker instance for myself. however i cannot make it work. my thought process was:

  • compile binary (works)
  • upload binary to server (works)
  • change docker compose to:
    services:
    vikunja:
    image: vikunja/vikunja
    environment:
    VIKUNJA_SERVICE_JWTSECRET: $JWTSecret
    VIKUNJA_SERVICE_PUBLICURL: $URL
    VIKUNJA_DATABASE_PATH: /db/vikunja.db
    VIKUNJA_FILES_BASEPATH: /app/files
    PUID: 0
    PGID: 0
    VIKUNJA_SERVICE_ENABLEREGISTRATION: “false”
    VIKUNJA_SERVICE_TIMEZONE: Europe/Berlin
    VIKUNJA_CORS_ENABLE: “true”
    VIKUNJA_CORS_ORIGINS: “*”
    ports:
    - 3456:3456
    volumes:
    - ./files:/app/files
    - ./db:/db
    - ./binary:/app/vikunja <-----------------
    restart: unless-stopped
    networks: {}

but it does not work, it always is running the official binary. i also tried to change the rootpath but it seems to ignore that setting. then i tried to use my own little dockerfile with just the entrypoint to the binary but somehow also that was not working (always getting “not found” errors for the entrypoint although the volume for sure had the file)

Long story short, do you have an idea how i can easily run my docker instance with a custom binary file?

i guess one idea would be to actually build my own image and upload it. damn i am not that experienced with docker but that seems to be the only way

Why don’t you just build the docker image from the dockerfile in the repo?

The “not found” issue is probably because you built the binary on your system, so it is linked to the system libraries on your os and not statically compiled.

Building your own image is the way to do. As kolaente said, you can use the Dockerfile from the repo. If you simply want to make a few changes, clone the repo, do your changes and use the Dockerfile as is.

If for whatever reason you still wand to build binary yourself (remember to include the frontend), then all you need is the last part:

# The actual image
FROM scratch
LABEL maintainer="maintainers@vikunja.io"
WORKDIR /app/vikunja
ENTRYPOINT [ "/app/vikunja/vikunja" ]
EXPOSE 3456
USER 1000

ENV VIKUNJA_SERVICE_ROOTPATH=/app/vikunja/
ENV VIKUNJA_DATABASE_PATH=/db/vikunja.db

COPY your-local-build vikunja
COPY ca-certificates.crt /etc/ssl/certs/

You will just need a CA bundle from anywhere, which would typically come from the linux distro used to build the image (Debian is this case). You way want to simply use and download the CA bundle extracted from Mozilla instead.

I suggest giving this this a try, it’s definitely the way to go. If you encounter any issues, the community here is super helpful :slight_smile:

ok so i figured out that the “no file or directory” issue was indeed because i was building it on WSL ubuntu and then tried to run it on the server docker. still strange as it was running fine directly on the server, but whatever. here are more infos linux - Docker Run Error: exec /app/backend/server: no such file or directory - Stack Overflow

so my battle plan is still to just build the binary and run it on the server. of course i could have the repo, whole building step etc. running on the server, but for now i wanted to streamline what is done on the server. it is yet not working because i get 500er errors upon accessing the app, but i will see what that could be. thanks for the infos much appreciated

i also figured out my 500 errors. turns out i need to comment out
//go:embed dist

from the frontend/embed.go file to be able to run vikunja locally on windows. that actually was the error when i tried to deploy it.

i am now successfully running my own little binary with my customizations (new dashboard with compact view of tasks and a sidebar to directly edit the task instead of having opening a new page). next up i need to clean everything and also style a few things. will let you know once i have a state i can happily share

Does it work if you build the frontend first? Build from sources | Vikunja

Looking forward to your changes! For design changes, it would be great to share a screenshot first.

actually it does not happen anymore. maybe because i have a /dist in frontend now.