Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Start with Go image to build the binary
FROM --platform=$BUILDPLATFORM golang:1.23-alpine AS builder

# Build arguments for versioning
ARG BUILD_VERSION
ARG GIT_COMMIT
ARG BUILD_DATE

# Install build dependencies including bash
RUN apk add --no-cache make git bash

Expand All @@ -19,6 +24,12 @@ RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH make build
# Final image
FROM --platform=$TARGETPLATFORM alpine:3.19

# Add version labels
LABEL version="${BUILD_VERSION}" \
git_commit="${GIT_COMMIT}" \
build_date="${BUILD_DATE}" \
description="Akave Link API Service"

# Install Node.js and npm
RUN apk add --no-cache nodejs npm

Expand All @@ -28,11 +39,9 @@ COPY --from=builder /app/bin/akavecli /usr/local/bin/akavecli
# Set working directory
WORKDIR /app

# Copy package files first (better layer caching)
# Copy package files first (better layer caching) and force npm to fetch latest packages
COPY package*.json ./

# Install only production dependencies
RUN npm install --production
RUN npm ci --no-cache --only=production && npm cache clean --force

# Copy source files
COPY server.js ./
Expand Down