-
-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1227 from loco-rs/fix-docker-gen
Fix generator Docker deployment to support both server-side and client-side rendering.
- Loading branch information
Showing
14 changed files
with
187 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
loco-gen/tests/templates/snapshots/generate[docker_file_[0]_[true]]@deployment.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
source: loco-gen/tests/templates/deployment.rs | ||
expression: "fs::read_to_string(tree_fs.root.join(\"dockerfile\")).expect(\"dockerfile missing\")" | ||
--- | ||
FROM rust:1.83.0-slim as builder | ||
|
||
WORKDIR /usr/src/ | ||
|
||
COPY . . | ||
|
||
RUN apt-get update && apt-get install -y curl ca-certificates | ||
|
||
# Install Node.js using the latest available version from NodeSource. | ||
# In production, replace "setup_current.x" with a specific version | ||
# to avoid unexpected breaking changes in future releases. | ||
RUN curl -fsSL https://deb.nodesource.com/setup_current.x | bash - && \ | ||
apt-get install -y nodejs | ||
RUN cd frontend && npm install && npm run build | ||
RUN cargo build --release | ||
|
||
FROM debian:bookworm-slim | ||
|
||
WORKDIR /usr/app | ||
|
||
COPY --from=builder /usr/src/config config | ||
COPY --from=builder /usr/src/target/release/tester-cli tester-cli | ||
|
||
ENTRYPOINT ["/usr/app/tester-cli"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
loco-gen/tests/templates/snapshots/generate[docker_file_[2]_[true]]@deployment.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
source: loco-gen/tests/templates/deployment.rs | ||
expression: "fs::read_to_string(tree_fs.root.join(\"dockerfile\")).expect(\"dockerfile missing\")" | ||
--- | ||
FROM rust:1.83.0-slim as builder | ||
|
||
WORKDIR /usr/src/ | ||
|
||
COPY . . | ||
|
||
RUN apt-get update && apt-get install -y curl ca-certificates | ||
|
||
# Install Node.js using the latest available version from NodeSource. | ||
# In production, replace "setup_current.x" with a specific version | ||
# to avoid unexpected breaking changes in future releases. | ||
RUN curl -fsSL https://deb.nodesource.com/setup_current.x | bash - && \ | ||
apt-get install -y nodejs | ||
RUN cd frontend && npm install && npm run build | ||
RUN cargo build --release | ||
|
||
FROM debian:bookworm-slim | ||
|
||
WORKDIR /usr/app | ||
|
||
COPY --from=builder /usr/src/404.html 404.html | ||
COPY --from=builder /usr/src/asset asset | ||
COPY --from=builder /usr/src/config config | ||
COPY --from=builder /usr/src/target/release/tester-cli tester-cli | ||
|
||
ENTRYPOINT ["/usr/app/tester-cli"] |
22 changes: 0 additions & 22 deletions
22
loco-gen/tests/templates/snapshots/generate[docker_file_[404_html]_[assets]]@deployment.snap
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
loco-gen/tests/templates/snapshots/generate[docker_file_[None]_[assets]]@deployment.snap
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.