Skip to content

Commit

Permalink
fix: Docker builds were triggering sqlc which required PG (#1113)
Browse files Browse the repository at this point in the history
There were multiple issues:

1. mtimes are not deterministic when git cloned
2. After this was fixed, it turns out that `touch` doesn't guarantee
subsecond consistency which broke `mk`.
  • Loading branch information
alecthomas authored Mar 20, 2024
1 parent 3855ff5 commit 0858fd7
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
**/.gradle
**/.idea
**/.vscode
!.vscode/tasks.json
**/*.sw*
frontend/dist
**/.DS_Store
3 changes: 3 additions & 0 deletions Dockerfile.controller
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ WORKDIR /src
# Seed some of the most common tools - this will be cached
RUN go version
RUN mvn -f kotlin-runtime/ftl-runtime -B --version
RUN node --version

# Download Go dependencies separately so Docker will cache them
COPY go.mod go.sum ./
Expand All @@ -20,6 +21,8 @@ RUN go mod download -x
# Build
COPY . /src/
RUN just errtrace
# Reset timestamps so that the build state is reset
RUN git ls-files -z | xargs -0 touch -r go.mod
RUN just build ftl-controller
RUN just build ftl-initdb
RUN just build ftl
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile.runner
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ RUN just build-kt-runtime

# Build runner
RUN just errtrace
# Reset timestamps so that the build state is reset
RUN git ls-files -z | xargs -0 touch -r go.mod
RUN just build ftl-runner
RUN just build ftl

Expand Down
5 changes: 3 additions & 2 deletions Justfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
set positional-arguments
set shell := ["bash", "-c"]

RELEASE := "build/release"
VERSION := `git describe --tags --always --dirty | sed -e 's/^v//'`
Expand Down Expand Up @@ -47,7 +48,7 @@ init-db:
dbmate create
dbmate --migrations-dir backend/controller/sql/schema up

# Regenerate SQLC code
# Regenerate SQLC code (requires init-db to be run first)
build-sqlc:
@mk backend/controller/sql/{db.go,models.go,querier.go,queries.sql.go} : backend/controller/sql/queries.sql backend/controller/sql/schema -- sqlc generate --experimental

Expand All @@ -71,4 +72,4 @@ npm-install:

# Regenerate protos
build-protos: npm-install
@mk {{SCHEMA_OUT}} : backend/schema -- "ftl-schema > {{SCHEMA_OUT}} && buf format -w && buf lint && cd backend/protos && buf generate"
@mk {{SCHEMA_OUT}} : backend/schema -- "ftl-schema > {{SCHEMA_OUT}} && buf format -w && buf lint && cd backend/protos && buf generate"
File renamed without changes.
2 changes: 1 addition & 1 deletion bin/mk

0 comments on commit 0858fd7

Please sign in to comment.