-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
187 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.nx | ||
dist | ||
node_modules | ||
tmp | ||
/.github | ||
/.vscode | ||
/target | ||
.env |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Build docker system | ||
|
||
Each app will be build in a separate container. This will allow us to scale the app independently and update only the front or back end without affecting the other. | ||
|
||
## Build the front end | ||
|
||
```bash | ||
podman build -t front:latest-dev -f build/front/Containerfile . | ||
``` | ||
|
||
## Build the back end | ||
|
||
```bash | ||
podman build -t back:latest-dev -f build/back/Containerfile . | ||
``` |
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,54 @@ | ||
FROM registry.hub.docker.com/library/rust:1.80 AS build | ||
|
||
WORKDIR /app | ||
|
||
# Prepare the build environment and cache dependencies | ||
RUN mkdir -p libs/markdown_header/src && \ | ||
mkdir -p libs/markdown_struct/src && \ | ||
mkdir -p libs/tool_tracing/src && \ | ||
mkdir -p apps/back/src && \ | ||
mkdir -p apps/back/src/bin | ||
|
||
COPY Cargo.toml . | ||
COPY ./libs/markdown_header/Cargo.toml ./libs/markdown_header/ | ||
COPY ./libs/markdown_struct/Cargo.toml ./libs/markdown_struct/ | ||
COPY ./libs/tool_tracing/Cargo.toml ./libs/tool_tracing/ | ||
COPY ./apps/back/Cargo.toml ./apps/back/ | ||
COPY .cargo . | ||
|
||
RUN echo "pub fn main() {}" > libs/markdown_header/src/lib.rs && \ | ||
echo "pub fn main() {}" > libs/markdown_struct/src/lib.rs && \ | ||
echo "pub fn main() {}" > libs/tool_tracing/src/lib.rs && \ | ||
echo "fn main() {}" > apps/back/src/main.rs && \ | ||
echo "fn main() {}" > apps/back/src/bin/sandbox.rs && \ | ||
echo "fn main() {}" > apps/back/src/bin/gen_swagger.rs | ||
|
||
RUN cargo build --release | ||
|
||
# Build the application | ||
COPY . . | ||
RUN touch apps/back/src/main.rs | ||
RUN cargo build --release | ||
|
||
RUN strip dist/target/release/server && \ | ||
strip dist/target/release/swagger | ||
|
||
FROM gcr.io/distroless/cc-debian12 | ||
#FROM registry.hub.docker.com/library/debian:bullseye-slim | ||
|
||
WORKDIR /app | ||
|
||
COPY --from=build /app/dist/target/release/server . | ||
COPY --from=build /app/dist/target/release/swagger . | ||
|
||
COPY ./folio_content/ . | ||
|
||
EXPOSE 5437 | ||
|
||
ENV API_PORT 5437 | ||
ENV ENV production | ||
ENV CONFIG_PATH content/config.yaml | ||
ENV CONTENT_PATH ./content | ||
|
||
CMD ["./server"] | ||
#CMD ["tail", "-f", "/dev/null"] |
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,23 @@ | ||
FROM registry.hub.docker.com/library/node:21 AS build | ||
WORKDIR /app | ||
ENV ENV production | ||
COPY package.json ./ | ||
COPY yarn.lock ./ | ||
RUN yarn | ||
COPY . ./ | ||
ENV ENV production | ||
RUN npx nx build front | ||
|
||
|
||
|
||
|
||
FROM registry.hub.docker.com/library/nginx:1.27-alpine AS deploy | ||
WORKDIR /usr/share/nginx/html | ||
|
||
RUN rm -rf ./* | ||
COPY ./build/front/nginx.conf /etc/nginx/conf.d/default.conf | ||
COPY --from=build /app/dist/apps/front . | ||
|
||
EXPOSE 8080 | ||
|
||
ENTRYPOINT [ "nginx", "-g", "daemon off;" ] |
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,17 @@ | ||
server { | ||
|
||
listen 8080; | ||
|
||
location / { | ||
root /usr/share/nginx/html; | ||
index index.html index.htm; | ||
try_files $uri $uri/ /index.html; | ||
} | ||
|
||
error_page 500 502 503 504 /50x.html; | ||
error_page 404 /index.html; | ||
|
||
location = /50x.html { | ||
root /usr/share/nginx/html; | ||
} | ||
} |
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,7 @@ | ||
FROM registry.hub.docker.com/library/nginx:1.27-alpine | ||
|
||
COPY ./build/reverse-proxy/nginx.conf /etc/nginx/conf.d/default.conf | ||
|
||
EXPOSE 3000 | ||
|
||
ENTRYPOINT [ "nginx", "-g", "daemon off;" ] |
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,13 @@ | ||
server { | ||
|
||
listen 3000; | ||
|
||
location /api { | ||
proxy_pass http://backend:5437; | ||
} | ||
|
||
location / { | ||
proxy_pass http://frontend:8080; | ||
} | ||
|
||
} |
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,36 @@ | ||
services: | ||
jaeger: | ||
image: jaegertracing/all-in-one:${JAEGER_VERSION:-latest} | ||
ports: | ||
- '16686:16686' | ||
- '4318:4318' | ||
- '14268:14268' | ||
- '4317:4317' | ||
environment: | ||
- LOG_LEVEL=debug | ||
|
||
backend: | ||
build: | ||
context: . | ||
dockerfile: build/back/Containerfile | ||
ports: | ||
- '5437:5437' | ||
environment: | ||
OTEL_OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger:4317 | ||
|
||
frontend: | ||
build: | ||
context: . | ||
dockerfile: build/front/Containerfile | ||
ports: | ||
- '8080:8080' | ||
|
||
reverse-proxy: | ||
build: | ||
context: . | ||
dockerfile: build/reverse-proxy/Containerfile | ||
ports: | ||
- '3000:3000' | ||
depends_on: | ||
- frontend | ||
- backend |
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