7
0
Fork
You've already forked LibRate
1
forked from mjh/LibRate

Optimize the Dockerfile for caching #2

Merged
CSDUMMI merged 3 commits from optimize-dockerfile into dev 2023年10月08日 17:43:06 +02:00

Every stage (command) in a dockerfile is individually cached and only reexecuted if a previous step had to be reexecuted as well.

It thus makes sense to include those steps in the dockerfile later that change more often.

Every stage (command) in a dockerfile is individually cached and only reexecuted if a previous step had to be reexecuted as well. It thus makes sense to include those steps in the dockerfile later that change more often.
Added:
- justfile for easier building
- loading config from specific file
Reviewed-on: mjh/LibRate#36
Co-authored-by: MJH <1a6f1a@riseup.net>
Co-committed-by: MJH <1a6f1a@riseup.net>
CSDUMMI force-pushed optimize-dockerfile from 8fc6a596db to 381db7bdba 2023年10月01日 21:28:36 +02:00 Compare
mjh left a comment
Collaborator
Copy link

please base your changes against the dev branch. It should be easier to review. Then we should consider merging dev into main if things don't turn out to be less stable than they were since the last update to main.

please base your changes against the dev branch. It should be easier to review. Then we should consider merging dev into main if things don't turn out to be less stable than they were since the last update to main.
Dockerfile Outdated
@ -12,0 +8,4 @@
WORKDIR /app
COPY ./fe /app/fe
RUN cd fe && npm install
Collaborator
Copy link

this is duplicate of just build_frontend from line 18

this is duplicate of `just build_frontend` from line 18
Author
Owner
Copy link

No, it is not.

As I mention in the description of this PR, docker caches the build process in stages and uses the cached stages unless a previous stage has been changed.

It is thus important, for a faster cached build process, to build the frontend when only the frontend code is included in the docker image - thus caching this step in the build process whenever no change to the frontend code has taken place.

No, it is not. As I mention in the description of this PR, docker caches the build process in stages and uses the cached stages unless a previous stage has been changed. It is thus important, for a faster cached build process, to build the frontend when only the frontend code is included in the docker image - thus caching this step in the build process whenever no change to the frontend code has taken place.
Collaborator
Copy link

so should the second build step, where we use just to do precisely the same but with a small added overhead of wrapping it in an one-liner that checks for presence of pnpm, which outside of dockerized environments, is slightly faster than npm, be removed?

so should the second build step, where we use `just` to do precisely the same but with a small added overhead of wrapping it in an one-liner that checks for presence of pnpm, which outside of dockerized environments, is slightly faster than npm, be removed?
@ -23,1 +24,4 @@
EXPOSE 3000
# initialize the database, don't launch the database subprocess and rely solely on pg_isready, run the migrations
#"migrate", "-auto-migrate, -init" flags were all removed as they were causing issues.
ENTRYPOINT ["/app/bin/librate", "-no-db-subprocess", "-hc-extern", "-config=/app/data/config.yml"]
Collaborator
Copy link

please reconsider adding the init flag, it should work after the recent changes and as indicated by the unit tests

please reconsider adding the `init` flag, it should work after the recent changes and as indicated by the unit tests
CSDUMMI changed title from (削除) Optimize the Dockerfile for caching (削除ここまで) to Optimize the Dockerfile for caching 2023年10月02日 09:47:31 +02:00
CSDUMMI changed target branch from main to dev 2023年10月02日 09:47:33 +02:00
Sign in to join this conversation.
No reviewers
mjh
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
GuildAlpha/LibRate!2
Reference in a new issue
GuildAlpha/LibRate
No description provided.
Delete branch "optimize-dockerfile"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?