Skip to content

Commit

Permalink
DBZ-8606: Add Dockerfile for stage image with build from the source r…
Browse files Browse the repository at this point in the history
…espo
  • Loading branch information
indraraj committed Jan 31, 2025
1 parent a436649 commit 9eb7a9b
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 27 deletions.
44 changes: 44 additions & 0 deletions stage/3.1/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
####
# This Dockerfile is used in order to build a container with Debezium platform UI.
###
ARG VERSION=main

# Clone the repository
FROM registry.access.redhat.com/ubi9/ubi-minimal AS cloner
ARG VERSION
WORKDIR /app
RUN microdnf install -y git && \
git clone https://github.com/debezium/debezium-platform.git && \
cd debezium-platform && \
git checkout ${VERSION} && \
cd debezium-platform-stage

# Build the application
FROM registry.access.redhat.com/ubi9/nodejs-20 AS builder
USER root
RUN mkdir -p /app && chown 1001:1001 /app
USER 1001
RUN npm install -g yarn

WORKDIR /app
COPY --from=cloner /app/debezium-platform/debezium-platform-stage/package.json /app/
COPY --from=cloner /app/debezium-platform/debezium-platform-stage/yarn.lock /app/
RUN yarn install

COPY --from=cloner /app/debezium-platform/debezium-platform-stage /app
RUN yarn build

# Final image
FROM mirror.gcr.io/library/node:20-alpine
RUN yarn global add serve

WORKDIR /app
COPY --from=builder /app/dist /app/dist
COPY --from=cloner /app/debezium-platform/debezium-platform-stage/inject-env.sh /inject-env.sh
RUN chmod +x /inject-env.sh

LABEL maintainer="Debezium Community" \
description="Debezium Platform Stage UI"

EXPOSE 3000
CMD ["/inject-env.sh"]
58 changes: 31 additions & 27 deletions stage/snapshot/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,40 +1,44 @@
####
# This Dockerfile is used in order to build a container with Debezium platform UI.
###
FROM registry.access.redhat.com/ubi9/nodejs-20 AS builder
WORKDIR /build

# Install package and extract necessary files
RUN npm install -g serve && \
npm install @debezium/platform-stage@latest && \
mkdir -p /build/output && \
cp -r node_modules/@debezium/platform-stage/dist /build/output/ && \
cp node_modules/@debezium/platform-stage/dist/inject-env.sh /build/output/
ARG VERSION=main

# Final image
FROM mirror.gcr.io/library/node:20-alpine
# Clone the repository
FROM registry.access.redhat.com/ubi9/ubi-minimal AS cloner
ARG VERSION
WORKDIR /app
RUN microdnf install -y git && \
git clone https://github.com/debezium/debezium-platform.git && \
cd debezium-platform && \
git checkout ${VERSION} && \
cd debezium-platform-stage

# Build the application
FROM registry.access.redhat.com/ubi9/nodejs-20 AS builder
USER root
RUN mkdir -p /app && chown 1001:1001 /app
USER 1001
RUN npm install -g yarn

RUN apk add --no-cache wget && \
npm install -g serve --production && \
addgroup -S appgroup && \
adduser -S appuser -G appgroup -u 1001 && \
chown -R appuser:appgroup /app
WORKDIR /app
COPY --from=cloner /app/debezium-platform/debezium-platform-stage/package.json /app/
COPY --from=cloner /app/debezium-platform/debezium-platform-stage/yarn.lock /app/
RUN yarn install

# Copy only necessary files from builder
COPY --from=builder --chown=appuser:appgroup /build/output/dist ./dist
COPY --from=builder --chown=appuser:appgroup /build/output/inject-env.sh ./inject-env.sh
RUN chmod +x /app/inject-env.sh
COPY --from=cloner /app/debezium-platform/debezium-platform-stage /app
RUN yarn build

USER appuser
# Final image
FROM mirror.gcr.io/library/node:20-alpine
RUN yarn global add serve

ENV NODE_ENV=production \
PORT=3000 \
PATH="/usr/local/bin:${PATH}"
WORKDIR /app
COPY --from=builder /app/dist /app/dist
COPY --from=cloner /app/debezium-platform/debezium-platform-stage/inject-env.sh /inject-env.sh
RUN chmod +x /inject-env.sh

LABEL maintainer="Debezium Community" \
description="Debezium Platform Stage UI" \
org.opencontainers.image.source="https://github.com/debezium/debezium-platform"
description="Debezium Platform Stage UI"

EXPOSE 3000
CMD ["./inject-env.sh"]
CMD ["/inject-env.sh"]

0 comments on commit 9eb7a9b

Please sign in to comment.