Fix a docker rebuild issue #88

Merged
hodlbod merged 6 commits from bugfix/docker-rebuild into dev 2026-03-03 19:52:23 +00:00
Collaborator

The Docker build wasn't making use of docker's cache because the .git directory was being copied into the build context. This means that even if the app did not change, if anything in git changed then docker would rebuild the entire app.

This excludes the .git folder from the docker build, instead relying on the user to pass in the build hash at build time. Which is annoying but I don't think there's a better way around it.

This was annoying me because I am deploying a self-hosted version of flotilla from a git branch via ansible and it was rebuilding flotilla every time.

The Docker build wasn't making use of docker's cache because the .git directory was being copied into the build context. This means that even if the app did not change, if anything in git changed then docker would rebuild the entire app. This excludes the .git folder from the docker build, instead relying on the user to pass in the build hash at build time. Which is annoying but I don't think there's a better way around it. This was annoying me because I am deploying a self-hosted version of flotilla from a git branch via ansible and it was rebuilding flotilla every time.
mplorentz added 2 commits 2026-02-27 17:47:48 +00:00
Author
Collaborator

I think someone forgot to commit their pnpm-lock on dev and I had to update it to get past the svelte-check pre-commit hook.

I think someone forgot to commit their pnpm-lock on `dev` and I had to update it to get past the `svelte-check` pre-commit hook.
Author
Collaborator

I didn't create a ticket for this but I totally can if desired.

I didn't create a ticket for this but I totally can if desired.
Author
Collaborator

Hm, I think this broke VITE_PLATFORM_LOGO and maybe other env vars. Need to re-evaluate the approach.

Hm, I think this broke `VITE_PLATFORM_LOGO` and maybe other env vars. Need to re-evaluate the approach.
mplorentz marked the pull request as work in progress 2026-02-27 18:21:56 +00:00
mplorentz added 1 commit 2026-02-27 18:35:41 +00:00
mplorentz added 3 commits 2026-02-27 20:23:26 +00:00
mplorentz reviewed 2026-03-03 19:42:21 +00:00
@@ -1,24 +1,31 @@
FROM node:20-slim
# Stage 1: Build
Author
Collaborator

I changed this to a two-stage docker build mostly because include .env in an image seems dangerous even if none of the env values are secrets at this time.

I changed this to a two-stage docker build mostly because include .env in an image seems dangerous even if none of the env values are secrets at this time.
mplorentz reviewed 2026-03-03 19:44:08 +00:00
@@ -17,2 +20,2 @@
if [[ $VITE_PLATFORM_LOGO =~ ^https://* ]]; then
curl $VITE_PLATFORM_LOGO > static/logo.png
if [[ $VITE_PLATFORM_LOGO =~ ^https:// ]]; then
curl -fSL "$VITE_PLATFORM_LOGO" -o static/logo.png
Author
Collaborator

The old curl command was failing silently for me so this one will fail the build if the logo URL exists but the logo cannot be fetched.

The old curl command was failing silently for me so this one will fail the build if the logo URL exists but the logo cannot be fetched.
mplorentz reviewed 2026-03-03 19:45:42 +00:00
@@ -7,1 +7,4 @@
fi
if [ -f .env ]; then
source .env
fi
Author
Collaborator

This fixes an issue I had with setting the logo. You could configure the other vars in .env because npx reads that automatically but the logo was being read here and wasn't respecting .env.

This fixes an issue I had with setting the logo. You could configure the other vars in `.env` because npx reads that automatically but the logo was being read here and wasn't respecting .env.
Author
Collaborator

Ok this cascaded into more changes than I wanted but I think I fixed a pre-existing bug with the logo download too. I have been shipping shipwreck.scuttle.works using this Dockerfile for a few days now on my feature/23-voice-room/poc branch and it seems to be working.

Ok this cascaded into more changes than I wanted but I think I fixed a pre-existing bug with the logo download too. I have been shipping shipwreck.scuttle.works using this Dockerfile for a few days now on my `feature/23-voice-room/poc` branch and it seems to be working.
mplorentz marked the pull request as ready for review 2026-03-03 19:48:19 +00:00
hodlbod was assigned by mplorentz 2026-03-03 19:48:30 +00:00
mplorentz requested review from hodlbod 2026-03-03 19:50:58 +00:00
hodlbod was unassigned by mplorentz 2026-03-03 19:51:01 +00:00
hodlbod merged commit a42ba5446a into dev 2026-03-03 19:52:23 +00:00
hodlbod deleted branch bugfix/docker-rebuild 2026-03-03 19:52:23 +00:00
Sign in to join this conversation.