traggo/server

Multi-stage docker builds for easier development setups

Closed this issue · 3 comments

Skeen commented

Is your feature request related to a problem? Please describe.
Getting a development setup up and running is tedious.

To get a development setup, I had to:

  • install yarn from a third-party apt source to get a usable yarn version.
  • run yarn install within the ui/ folder.
  • run make download-tools
  • Modify the Makefile:
diff --git a/Makefile b/Makefile
index fb67924..542d564 100644
--- a/Makefile
+++ b/Makefile
@@ -70,10 +70,10 @@ build-js:
        (cd ui && yarn build)
 
 packr:
-       packr2
+       go run github.com/gobuffalo/packr/v2/packr2@v2.7.1
 
 packr-clean:
-       packr2 clean
+       go run github.com/gobuffalo/packr/v2/packr2@v2.7.1 clean
 
 pre-build: build-js packr

As packr did not run for me without it.

  • Run make build-bin-linux-amd64
  • Run build-docker-linux-amd64

Describe the solution you'd like
My first approach to building the project was the solution I would like, namely, simply running:

docker build -f docker/Dockerfile .

I expected this to do a multi-stage build, with the first-stage producing the traggo binary, and the second stage containing the current contents of the Dockerfile making a small image.

Describe alternatives you've considered
Not working on the project and instead looking for another time-tracking software.

When developing you normally want to use dev modes of the server / ui, for this you normally don't need packr2 as it'll work without it. I didn't use the docker build for development, thus, it isn't optimized for this. I'd be open to include another Dockerfile for development.

You probably don't have the go bin folder on your path, this made the make build-bin thingy fail.

Skeen commented

Hello @jmattheis, I made a PR that simply builds the source so you can get a stack up and running with one command.
I am a Go-programmer and I do not know the tools usually used for Go-development.

What are the dev modes of the server and ui that you speak of, and what commands would you usually run? - I imagine there's support for hot-reloading somehow?

Yeah, there is hot reloading for the UI, it can be started with yarn start. See https://traggo.net/dev/setup/