mirror of
https://github.com/amir20/dozzle.git
synced 2026-06-23 04:10:12 +00:00
chore: optimize Docker build and CI workflows (#4499)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -6,4 +6,3 @@ dist
|
|||||||
.git
|
.git
|
||||||
e2e
|
e2e
|
||||||
docs
|
docs
|
||||||
internal/agent/pb/
|
|
||||||
|
|||||||
@@ -17,15 +17,11 @@ jobs:
|
|||||||
name: Install pnpm
|
name: Install pnpm
|
||||||
- uses: actions/setup-node@v6
|
- uses: actions/setup-node@v6
|
||||||
name: Install Node
|
name: Install Node
|
||||||
with:
|
|
||||||
node-version: 24.14.0
|
|
||||||
- run: corepack enable
|
|
||||||
- run: pnpm --version
|
|
||||||
- uses: actions/setup-node@v6
|
|
||||||
with:
|
with:
|
||||||
node-version: 24.14.0
|
node-version: 24.14.0
|
||||||
cache: "pnpm"
|
cache: "pnpm"
|
||||||
cache-dependency-path: "**/pnpm-lock.yaml"
|
cache-dependency-path: "**/pnpm-lock.yaml"
|
||||||
|
- run: corepack enable
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: pnpm install --frozen-lockfile --prefer-offline
|
run: pnpm install --frozen-lockfile --prefer-offline
|
||||||
- name: Run Tests
|
- name: Run Tests
|
||||||
@@ -59,15 +55,11 @@ jobs:
|
|||||||
name: Install pnpm
|
name: Install pnpm
|
||||||
- uses: actions/setup-node@v6
|
- uses: actions/setup-node@v6
|
||||||
name: Install Node
|
name: Install Node
|
||||||
with:
|
|
||||||
node-version: 24.14.0
|
|
||||||
- run: corepack enable
|
|
||||||
- run: pnpm --version
|
|
||||||
- uses: actions/setup-node@v6
|
|
||||||
with:
|
with:
|
||||||
node-version: 24.14.0
|
node-version: 24.14.0
|
||||||
cache: "pnpm"
|
cache: "pnpm"
|
||||||
cache-dependency-path: "**/pnpm-lock.yaml"
|
cache-dependency-path: "**/pnpm-lock.yaml"
|
||||||
|
- run: corepack enable
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: pnpm install
|
run: pnpm install
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8
|
platforms: linux/amd64,linux/arm64/v8
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
build-args: TAG=${{ steps.meta.outputs.version }}
|
build-args: TAG=${{ steps.meta.outputs.version }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
|||||||
+5
-11
@@ -14,7 +14,7 @@ COPY package.json ./
|
|||||||
RUN pnpm install --offline --ignore-scripts --no-optional
|
RUN pnpm install --offline --ignore-scripts --no-optional
|
||||||
|
|
||||||
# Copy assets and translations to build
|
# Copy assets and translations to build
|
||||||
COPY .* *.config.ts *.config.js *.config.cjs ./
|
COPY vite.config.ts tsconfig.json .prettierrc.cjs .npmrc ./
|
||||||
COPY assets ./assets
|
COPY assets ./assets
|
||||||
COPY locales ./locales
|
COPY locales ./locales
|
||||||
COPY public ./public
|
COPY public ./public
|
||||||
@@ -24,17 +24,13 @@ RUN pnpm build
|
|||||||
|
|
||||||
FROM --platform=$BUILDPLATFORM golang:1.26-alpine AS builder
|
FROM --platform=$BUILDPLATFORM golang:1.26-alpine AS builder
|
||||||
|
|
||||||
# install gRPC dependencies
|
RUN apk add --no-cache ca-certificates && mkdir /dozzle
|
||||||
RUN apk add --no-cache ca-certificates protoc protobuf-dev \
|
|
||||||
&& mkdir /dozzle \
|
|
||||||
&& go install google.golang.org/protobuf/cmd/protoc-gen-go@latest \
|
|
||||||
&& go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
|
|
||||||
|
|
||||||
WORKDIR /dozzle
|
WORKDIR /dozzle
|
||||||
|
|
||||||
# Copy go mod files
|
# Copy go mod files
|
||||||
COPY go.* ./
|
COPY go.* ./
|
||||||
RUN go mod download
|
RUN --mount=type=cache,target=/go/pkg/mod go mod download
|
||||||
|
|
||||||
# Copy all other files
|
# Copy all other files
|
||||||
COPY internal ./internal
|
COPY internal ./internal
|
||||||
@@ -50,11 +46,9 @@ COPY --from=node /build/dist ./dist
|
|||||||
ARG TAG=dev
|
ARG TAG=dev
|
||||||
ARG TARGETOS TARGETARCH
|
ARG TARGETOS TARGETARCH
|
||||||
|
|
||||||
# Generate protos and graphql
|
|
||||||
RUN go generate ./...
|
|
||||||
|
|
||||||
# Build binary
|
# Build binary
|
||||||
RUN GOEXPERIMENT=jsonv2 GOOS=$TARGETOS GOARCH=$TARGETARCH CGO_ENABLED=0 go build -ldflags "-s -w -X github.com/amir20/dozzle/internal/support/cli.Version=$TAG" -o dozzle
|
RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build \
|
||||||
|
GOEXPERIMENT=jsonv2 GOOS=$TARGETOS GOARCH=$TARGETARCH CGO_ENABLED=0 go build -ldflags "-s -w -X github.com/amir20/dozzle/internal/support/cli.Version=$TAG" -o dozzle
|
||||||
|
|
||||||
RUN mkdir /data
|
RUN mkdir /data
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user