1
0
mirror of https://github.com/amir20/dozzle.git synced 2025-12-24 06:28:42 +01:00
Files
dozzle/Dockerfile
renovate[bot] d37c1395cb fix(deps): update all non-major dependencies (#2937)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-05-08 00:13:33 +00:00

61 lines
1.2 KiB
Docker

# Build assets
FROM --platform=$BUILDPLATFORM node:21.7.3-alpine as node
RUN corepack enable
WORKDIR /build
# Install dependencies from lock file
COPY pnpm-*.yaml ./
RUN pnpm fetch --ignore-scripts --no-optional
# Copy package.json and install dependencies
COPY package.json ./
RUN pnpm install --offline --ignore-scripts --no-optional
# Copy assets and translations to build
COPY .* *.config.ts *.config.js *.config.cjs ./
COPY assets ./assets
COPY locales ./locales
COPY public ./public
# Build assets
RUN pnpm build
FROM --platform=$BUILDPLATFORM golang:1.22.3-alpine AS builder
RUN apk add --no-cache ca-certificates && mkdir /dozzle
WORKDIR /dozzle
# Copy go mod files
COPY go.* ./
RUN go mod download
# Copy assets built with node
COPY --from=node /build/dist ./dist
# Copy all other files
COPY internal ./internal
COPY main.go ./
# Args
ARG TAG=dev
ARG TARGETOS TARGETARCH
# Build binary
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH CGO_ENABLED=0 go build -ldflags "-s -w -X main.version=$TAG" -o dozzle
RUN mkdir /data
FROM scratch
ENV PATH /bin
COPY --from=builder /data /data
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /dozzle/dozzle /dozzle
EXPOSE 8080
ENTRYPOINT ["/dozzle"]