-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a poc to try to build the frontend container locally, and check if it could be deployed in ephemeral environment. Signed-off-by: Alejandro Visiedo <[email protected]>
- Loading branch information
Showing
2 changed files
with
92 additions
and
0 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,65 @@ | ||
{ | ||
{$CADDY_TLS_MODE} | ||
auto_https disable_redirects | ||
servers { | ||
metrics | ||
} | ||
} | ||
|
||
:9000 { | ||
metrics /metrics | ||
} | ||
|
||
:8000 { | ||
{$CADDY_TLS_CERT} | ||
log | ||
|
||
# Handle main app route | ||
@app_match { | ||
path ${ROUTE_PATH}* | ||
} | ||
handle @app_match { | ||
uri strip_prefix ${ROUTE_PATH} | ||
file_server * { | ||
root /opt/app-root/src/dist | ||
browse | ||
} | ||
} | ||
|
||
# Handle beta app route | ||
@beta_match { | ||
path ${BETA_ROUTE_PATH}* | ||
} | ||
handle @beta_match { | ||
uri strip_prefix ${BETA_ROUTE_PATH} | ||
file_server * { | ||
root /opt/app-root/src/dist | ||
browse | ||
} | ||
} | ||
|
||
# Handle preview app route | ||
@preview_match { | ||
path ${PREVIEW_ROUTE_PATH}* | ||
} | ||
handle @preview_match { | ||
uri strip_prefix ${PREVIEW_ROUTE_PATH} | ||
file_server * { | ||
root /opt/app-root/src/dist | ||
browse | ||
} | ||
} | ||
|
||
handle /beta/ { | ||
redir /beta/apps/chrome/index.html permanent | ||
} | ||
|
||
handle /preview/ { | ||
redir /preview/apps/chrome/index.html permanent | ||
} | ||
|
||
handle / { | ||
redir /apps/chrome/index.html permanent | ||
} | ||
} | ||
|
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,27 @@ | ||
FROM registry.redhat.io/rhel9/nodejs-16:1-110 AS builder | ||
USER root | ||
# COPY --chown=1001:1001 package*.json . | ||
COPY package*.json . | ||
# The working dir is at /opt/app-root/src | ||
RUN mkdir -p ".cache/Cypress" | ||
RUN npm install | ||
# COPY --chown=1001:1001 . . | ||
COPY . . | ||
#COPY --from=dependencies --chown=1001:1001 /usr/src/app/node_modules . | ||
RUN npm run build | ||
|
||
FROM quay.io/cloudservices/caddy-ubi:11145b1 | ||
ENV CADDY_TLS_MODE="http_port 8000" | ||
ENV APP_NAME="idmsvc" | ||
ENV ROUTE_PATH="/apps/${APP_NAME}" | ||
ENV BETA_ROUTE_PATH="/beta/apps/${APP_NAME}" | ||
ENV PREVIEW_ROUTE_PATH="/preview/apps/${APP_NAME}" | ||
|
||
COPY Caddyfile /opt/app-root/src/Caddyfile | ||
COPY --from=builder /opt/app-root/src/dist /opt/app-root/src/dist | ||
# COPY package.json /opt/app-root/src | ||
WORKDIR /opt/app-root/src/dist | ||
CMD ["caddy", "run", "--config", "/opt/app-root/src/Caddyfile"] | ||
|
||
EXPOSE 8000 | ||
|