Skip to content

Modern Docker Management, Designed for Everyone

fix: exposed ports woroding rework will show published/exposed or a mix of the two

Kyle Mendellebee116acc9d
diff --git a/docker/Dockerfile.dev b/docker/Dockerfile.dev
index 3f6b8fc71..db3984070 100644
--- a/docker/Dockerfile.dev
+++ b/docker/Dockerfile.dev
@@ -1,27 +1,41 @@
+# syntax=docker/dockerfile:1
+
+# Stage 1: Frontend Development with optimized caching
FROM --platform=$BUILDPLATFORM node:25-trixie-slim AS frontend-dev
-RUN npm install -g --force corepack && corepack enable
+
+RUN npm install -g --force corepack && corepack enable pnpm
+
+ENV PNPM_HOME="/pnpm"
+ENV PATH="$PNPM_HOME:$PATH"
+
WORKDIR /app
-# Copy package configuration files and install dependencies
-COPY package.json pnpm-workspace.yaml pnpm-lock.yaml ./
+# Copy lockfile first for better layer caching
+COPY pnpm-lock.yaml ./
+
+# Fetch dependencies with cache mount
+RUN --mount=type=cache,target=/pnpm/store \
+ pnpm fetch --frozen-lockfile
+
+# Copy package files and install
+COPY package.json pnpm-workspace.yaml ./
COPY frontend/package.json ./frontend/package.json
-RUN --mount=type=cache,target=/root/.pnpm-store pnpm install --frozen-lockfile
-# Set development environment
-ENV NODE_ENV=development
-ENV PORT=3000
+RUN --mount=type=cache,target=/pnpm/store \
+ pnpm install --frozen-lockfile --offline
+
+ENV NODE_ENV=development \
+ PORT=3000
-# Expose frontend development port
EXPOSE 3000
-# Start frontend development server with hot reload
CMD ["pnpm", "-C", "frontend", "dev", "--host", "0.0.0.0"]
-# Stage 2: Backend Development
+# Stage 2: Backend Development with optimized caching
FROM --platform=$BUILDPLATFORM golang:1.25-trixie AS backend-dev
-# Install development tools and dependencies
-RUN apt-get update && apt-get install -y \
+# Install development tools in a single layer
+RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
git \
@@ -29,27 +43,26 @@ RUN apt-get update && apt-get install -y \
rm -rf /var/lib/apt/lists/* && \
go install github.com/air-verse/air@latest
-# Set development environment variables
-ENV GIN_MODE=debug
-ENV PORT=3552
-ENV ENVIRONMENT=development
-ENV GOCACHE=/go/cache
-ENV GOMODCACHE=/go/pkg/mod
+ENV GIN_MODE=debug \
+ PORT=3552 \
+ ENVIRONMENT=development \
+ GOCACHE=/root/.cache/go-build \
+ GOMODCACHE=/go/pkg/mod
WORKDIR /app
-# Copy Go module files and download dependencies
+# Copy Go module files first for dependency caching
COPY backend/go.mod backend/go.sum ./
+
+# Download dependencies with cache mounts
RUN --mount=type=cache,target=/go/pkg/mod \
- --mount=type=cache,target=/go/cache \
- go mod download
+ --mount=type=cache,target=/root/.cache/go-build \
+ go mod download && go mod verify
-# Create directories for development with proper permissions
-RUN mkdir -p /app/data /app/.bin /go/cache && \
- chmod 755 /app/data /app/.bin /go/cache
+# Create directories with proper permissions
+RUN mkdir -p /app/data /app/.bin && \
+ chmod 755 /app/data /app/.bin
-# Expose backend development port
EXPOSE 3552
-# Use Air for hot reloading in development
CMD ["air", "-c", ".air.toml"]
diff --git a/frontend/src/routes/containers/components/ContainerOverview.svelte b/frontend/src/routes/containers/components/ContainerOverview.svelte
index 1e518eb67..9226f54fc 100644
--- a/frontend/src/routes/containers/components/ContainerOverview.svelte
+++ b/frontend/src/routes/containers/components/ContainerOverview.svelte
@@ -66,7 +66,35 @@
}
const restartPolicy = $derived(container.hostConfig?.restartPolicy || 'no');
- const portCount = $derived(container.ports?.length || 0);
+
+ // Deduplicate and categorize ports
+ const uniquePorts = $derived.by(() => {
+ if (!container.ports?.length) return { published: 0, exposed: 0, total: 0 };
+
+ const seen = new Set<string>();
+ let published = 0;
+ let exposed = 0;
+
+ for (const p of container.ports) {
+ const privatePort = (p as any).privatePort ?? (p as any).target ?? 0;
+ const publicPort = (p as any).publicPort ?? (p as any).hostPort ?? (p as any).published ?? null;
+ const proto = (p as any).type ?? (p as any).protocol ?? 'tcp';
+
+ // Create unique key for deduplication
+ const key = `${publicPort ?? ''}:${privatePort}/${proto}`;
+ if (seen.has(key)) continue;
+ seen.add(key);
+
+ if (publicPort && publicPort !== 0) {
+ published++;
+ } else {
+ exposed++;
+ }
+ }
+
+ return { published, exposed, total: published + exposed };
+ });
+
const mountCount = $derived(container.mounts?.length || 0);
const networkCount = $derived(container.networkSettings?.networks ? Object.keys(container.networkSettings.networks).length : 0);
</script>
@@ -224,8 +252,15 @@
<Card.Content class="flex flex-col gap-2 p-4">
<div class="text-muted-foreground text-xs font-semibold tracking-wide uppercase">Ports</div>
<div class="text-foreground text-sm font-medium">
- {portCount}
- {portCount === 1 ? 'port' : 'ports'} exposed
+ {#if uniquePorts.total === 0}
+ No ports
+ {:else if uniquePorts.published > 0 && uniquePorts.exposed > 0}
+ {uniquePorts.published} published, {uniquePorts.exposed} exposed
+ {:else if uniquePorts.published > 0}
+ {uniquePorts.published} published
+ {:else}
+ {uniquePorts.exposed} exposed
+ {/if}
</div>
</Card.Content>
</Card.Root>