Skip to content

Commit

Permalink
Set compose into a single file. Fix docker build stage orders so that…
Browse files Browse the repository at this point in the history
… prod is default.
  • Loading branch information
gpkc committed Mar 12, 2024
1 parent 6802f1d commit e8d17af
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 33 deletions.
13 changes: 9 additions & 4 deletions container/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ COPY . /build/karapace-repo
RUN --mount=type=cache,target=/root/.cache/pip \
python3 -m pip install /build/karapace-repo

# Karapace image, i.e. production.
FROM python:3.10.11-slim-bullseye AS karapace

FROM python:3.10.11-slim-bullseye AS karapace-base

# Setup user and directories.
RUN groupadd --system karapace \
Expand Down Expand Up @@ -65,14 +65,15 @@ RUN --mount=type=cache,target=/root/.cache/pip \


# Dev build stage
FROM karapace AS dev
FROM karapace-base AS dev

# Install linux dependencies
USER root

ARG OPENJDK_VERSION="11.0.22+7-1~deb11u1"
RUN apt-get update \
&& apt-get install --assume-yes --no-install-recommends \
openjdk-11-jdk \
openjdk-11-jdk=$OPENJDK_VERSION \
&& rm -rf /var/lib/apt/lists/*

USER karapace
Expand All @@ -82,3 +83,7 @@ COPY --from=dev-builder /venv /venv

RUN mkdir /opt/karapace/app
ENV PYTHONPATH="/opt/karapace/app:${PYTHONPATH}"


# Production build stage (keep last so it's the default)
FROM karapace-base AS karapace
29 changes: 0 additions & 29 deletions container/compose-dev.yml

This file was deleted.

18 changes: 18 additions & 0 deletions container/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ services:
build:
context: ..
dockerfile: container/Dockerfile
target: dev
volumes:
- ../:/opt/karapace/app
entrypoint:
- /bin/bash
- /opt/karapace/start.sh
Expand All @@ -84,6 +87,9 @@ services:
build:
context: ..
dockerfile: container/Dockerfile
target: dev
volumes:
- ../:/opt/karapace/app
entrypoint:
- /bin/bash
- /opt/karapace/start.sh
Expand All @@ -102,3 +108,15 @@ services:
KARAPACE_REGISTRY_PORT: 8081
KARAPACE_ADMIN_METADATA_MAX_AGE: 0
KARAPACE_LOG_LEVEL: WARNING

karapace-dev:
image: karapace:latest
build:
context: ..
dockerfile: container/Dockerfile
target: dev
volumes:
- ../:/opt/karapace/app
working_dir: /opt/karapace/app
depends_on:
- kafka

0 comments on commit e8d17af

Please sign in to comment.