-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DBZ-7447 Add Debezium UI container image for production use based on …
…nginx-alpine closes https://issues.redhat.com/browse/DBZ-7447
- Loading branch information
Showing
5 changed files
with
74 additions
and
16 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 |
---|---|---|
@@ -1,21 +1,25 @@ | ||
#### | ||
# This Dockerfile is used in order to build a container with Debezium UI. | ||
# This Dockerfile is used to build a production container image for Debezium UI. | ||
### | ||
# Build UI | ||
FROM registry.access.redhat.com/ubi9/nodejs-18 AS build | ||
FROM registry.access.redhat.com/ubi9/nodejs-20:1-24 as builder | ||
|
||
WORKDIR /app | ||
COPY --chown=1001 package*.json ./ | ||
|
||
RUN npm install | ||
|
||
COPY --chown=1001 . . | ||
RUN npm run build | ||
|
||
# Final image with only build artifacts | ||
FROM node:18-slim | ||
WORKDIR /app | ||
RUN npm install express | ||
COPY --from=build /app/dist/serve.js /app/dist/config.js ./ | ||
COPY --from=build /app/dist ./dist | ||
EXPOSE 3000 | ||
ENV NODE_ENV=production | ||
|
||
# Build the React application | ||
RUN npm run build | ||
|
||
|
||
FROM nginx:1.25.3-alpine | ||
|
||
ENV KAFKA_CONNECT_CLUSTERS=http://localhost:8083/ | ||
CMD ["node", "serve"] | ||
|
||
COPY --from=builder /app/dist /usr/share/nginx/html | ||
COPY config.json /app/config.json | ||
COPY deployment/image/create-dbzui-config.sh /docker-entrypoint.d/ |
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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
// config.js | ||
module.exports = { | ||
KAFKA_CONNECT_CLUSTERS: process.env.KAFKA_CONNECT_CLUSTERS || 'http://localhost:8084/,http://localhost:8085/', | ||
}; | ||
|
||
KAFKA_CONNECT_CLUSTERS: process.env.KAFKA_CONNECT_CLUSTERS || 'http://localhost:8083', | ||
}; |
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,3 @@ | ||
{ | ||
"KAFKA_CONNECT_CLUSTERS": "http://localhost:8083" | ||
} |
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,33 @@ | ||
#!/bin/sh | ||
# vim:sw=4:ts=4:et | ||
|
||
set -e | ||
|
||
entrypoint_log() { | ||
if [ -z "${NGINX_ENTRYPOINT_QUIET_LOGS:-}" ]; then | ||
echo "$@" | ||
fi | ||
} | ||
|
||
ME=$(basename "$0") | ||
DBZUI_CONFIG_TEMPLATE="/app/config.json" | ||
DBZUI_CONFIG_FILE="/usr/share/nginx/html/config" | ||
|
||
if [ ! -f "${DBZUI_CONFIG_TEMPLATE}" ]; then | ||
echo "${ME}: ERROR: ${DBZUI_CONFIG_TEMPLATE} is not a file or does not exist" | ||
exit 1 | ||
fi | ||
|
||
# check if the file can be modified, e.g. not on a r/o filesystem | ||
cp "${DBZUI_CONFIG_TEMPLATE}" "${DBZUI_CONFIG_FILE}" >/dev/null 2>&1 || { echo "$ME: ERROR: can not modify ${DBZUI_CONFIG_FILE} (read-only file system?)"; exit 1; } | ||
|
||
if [ "${KAFKA_CONNECT_CLUSTERS}" == "http://localhost:8083" ] ; then | ||
## nothing to do, keep the default config | ||
exit 0 | ||
fi | ||
|
||
# escaping slashes | ||
KAFKA_CONNECT_CLUSTERS_ESCAPED=`echo ${KAFKA_CONNECT_CLUSTERS} | sed -e 's;\/;\\\/;g'` | ||
sed -i "s/http:\/\/localhost:8083/${KAFKA_CONNECT_CLUSTERS_ESCAPED}/g" "${DBZUI_CONFIG_FILE}" | ||
|
||
exit 0 |
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,20 @@ | ||
#### | ||
# This Dockerfile is used in order to build a container with Debezium UI for development. | ||
### | ||
FROM registry.access.redhat.com/ubi9/nodejs-18 | ||
|
||
WORKDIR /app | ||
|
||
COPY --chown=1001 package*.json ./ | ||
|
||
RUN npm install | ||
|
||
COPY --chown=1001 . . | ||
|
||
ENV NODE_ENV=production | ||
ENV KAFKA_CONNECT_CLUSTERS=http://localhost:8083/ | ||
|
||
RUN npm run build | ||
|
||
EXPOSE 3000 | ||
CMD ["npm", "run", "start:dev"] |