-
Notifications
You must be signed in to change notification settings - Fork 48
Build webapp assets during Docker build instead of checking them into git #611
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # Node.js | ||
| webapp/node_modules/ | ||
| webapp/build/ | ||
|
|
||
| # Go | ||
| vendor/ | ||
|
|
||
| # IDE | ||
| .vscode/ | ||
| .idea/ | ||
|
|
||
| # Build artifacts | ||
| bin/ | ||
| dist/ | ||
|
|
||
| # Test artifacts | ||
| coverage/ | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,3 +1,13 @@ | ||||||||||||||||||||||
| # Stage 1: Build webapp | ||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This Dockerfile was initially written to be built once and reused many times by just creating a new temporary container from it and running the build-static.sh script. But given that we might need to also build and copy the webapp now, I think we can expand it a bit more and just run docker build to get the static binary. See bellow comments. |
||||||||||||||||||||||
| FROM docker.io/node:lts-alpine AS webapp | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| WORKDIR /build/webapp | ||||||||||||||||||||||
| COPY webapp/package.json webapp/package-lock.json ./ | ||||||||||||||||||||||
| RUN npm ci | ||||||||||||||||||||||
| COPY webapp/ ./ | ||||||||||||||||||||||
| RUN npm run build | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Stage 2: Build Go binaries | ||||||||||||||||||||||
| FROM docker.io/golang:alpine | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| WORKDIR /root | ||||||||||||||||||||||
|
|
@@ -14,4 +24,7 @@ RUN chmod +x /build-static.sh | |||||||||||||||||||||
|
|
||||||||||||||||||||||
| ADD . /build/garm | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Copy webapp build output to assets directory | ||||||||||||||||||||||
| COPY --from=webapp /build/webapp/build/ /build/garm/webapp/assets/ | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| CMD ["/bin/sh"] | ||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can replace this with
Suggested change
See the Makefile comment for the last bit. |
||||||||||||||||||||||
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be removed, otherwise
build-static.shwill fail. As the build commands there use-mod vendor