Gokapi icon indicating copy to clipboard operation
Gokapi copied to clipboard

Documentation: Instructions for customising Gokapi with Docker

Open Giuseppe-TD opened this issue 1 year ago • 4 comments

hi.. i've tried to find where to customize the DOCKER version under portainer, but i can't find, can you guide me to the position of the configuration files/folder

thanks :D

Giuseppe-TD avatar Jul 16 '24 15:07 Giuseppe-TD

Hi, thanks for the feedback! I will improve the documentation in that regard, as it is a little bit outdated and does not go too much into detail on how to customise Docker based instances.

You can follow the current documentation found here. As only the minimised versions are used, you have to run go generate ./... or replace the minimised versions instead. Then mount the static folder to /app/static and/or the template folder to /app/templates

Forceu avatar Jul 16 '24 16:07 Forceu

i'm tring to copy the file with scp in app/ or /templates in the root directory , but with portainer i think the files are stored somewhere else.. i can't figure how to do :|

Giuseppe-TD avatar Jul 16 '24 17:07 Giuseppe-TD

in portainer i added the two lines, templates and static

services: gokapi: container_name: Gokapi image: f0rc3/gokapi:latest ports: - 53842:53842 volumes: - /portainer/Files/AppData/Config/gokapi/data:/app/data - /portainer/Files/AppData/Config/gokapi/config:/app/config - /portainer/Files/AppData/Config/gokapi/templates:/app/templates - /portainer/Files/AppData/Config/gokapi/static:/app/static

restart: always

copied the folder from my computer in the same directory of data and config under /portainer/Files/AppData

in the logs i see:

Found folder 'templates', using local folder instead of internal template folder

Found folder 'static', using local folder instead of internal static folder

then i uploaded a new background and modified css to pick the new background

but when i restart the container/server the background don't change

Giuseppe-TD avatar Jul 17 '24 09:07 Giuseppe-TD

@Raxiel1987 / @Forceu - I have personally added gokapi as a submodule, and then use a Dockerfile like this:

./gokapi/  # <--- submodule
./Dockerfile
./web/  # <--- Contains changed versions of the css and js for company branding purposes
FROM golang:1.22.3-alpine AS build_base

RUN mkdir /compile
COPY ./gokapi/go.mod /compile
RUN cd /compile && go mod download

COPY ./gokapi/ /compile
COPY ./web/ /compile/internal/webserver/web/  # <--- Copy our web folder into the image before the go generate step

RUN cd /compile && go generate ./... && CGO_ENABLED=0 go build -ldflags="-s -w -X 'github.com/forceu/gokapi/internal/environment.IsDocker=true' -X 'github.com/forceu/gokapi/internal/environment.Builder=Project Docker File' -X 'github.com/forceu/gokapi/internal/environment.BuildTime=$(date)'" -o /compile/gokapi github.com/forceu/gokapi/cmd/gokapi

FROM alpine:3.19

RUN addgroup -S gokapi && adduser -S gokapi -G gokapi
RUN apk update && apk add --no-cache su-exec tini ca-certificates curl tzdata && mkdir /app && touch /app/.isdocker

COPY ./gokapi/dockerentry.sh /app/run.sh

COPY --from=build_base /compile/gokapi /app/gokapi
WORKDIR /app

ENTRYPOINT ["/sbin/tini", "--"]
CMD ["/app/run.sh"]
HEALTHCHECK --interval=10s --timeout=5s --retries=3 CMD curl --fail http://127.0.0.1:53842 || exit 1

MalteMagnussen avatar Jul 24 '24 10:07 MalteMagnussen

i just changed /themed my installation of gokapi, but i have a question, now i've copied templates and static and configured the path, but if a new version is deployed i have to update the folder aswell? or not?

Giuseppe-TD avatar Feb 05 '25 19:02 Giuseppe-TD

Sorry I did not see your last reply.

With Gokapi 2.0 (a pre-release is already available) the whole customisation has been changed to additive CSS and JS, you find the documentation here: https://gokapi.readthedocs.io/en/latest/advanced.html#customising

I will therefore close the issue.

Forceu avatar May 25 '25 15:05 Forceu