build: Update docker build
This commit is contained in:
4 files changed
+25
-12
No files matched your search
@@ -0,0 +1,9 @@
|
||||
.git
|
||||
.github
|
||||
gpt-load
|
||||
data
|
||||
tmp
|
||||
web/node_modules
|
||||
web/dist
|
||||
*.log
|
||||
.DS_Store
|
||||
@@ -8,6 +8,7 @@ jobs:
|
||||
build_docker_image:
|
||||
name: Build Docker Image
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 45
|
||||
permissions:
|
||||
packages: write
|
||||
contents: read
|
||||
@@ -18,6 +19,11 @@ jobs:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
with:
|
||||
platforms: arm64
|
||||
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
|
||||
@@ -121,9 +121,6 @@ coverage
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
|
||||
# Docker
|
||||
.dockerignore
|
||||
|
||||
# Database files
|
||||
*.db
|
||||
*.sqlite
|
||||
|
||||
+10
-9
@@ -1,34 +1,35 @@
|
||||
FROM node:20-alpine AS builder
|
||||
FROM --platform=$BUILDPLATFORM node:20-alpine AS builder
|
||||
|
||||
ARG VERSION=1.0.0
|
||||
WORKDIR /build
|
||||
COPY ./web/package*.json ./
|
||||
RUN npm ci
|
||||
COPY ./web .
|
||||
RUN npm install
|
||||
RUN VITE_VERSION=${VERSION} npm run build
|
||||
|
||||
|
||||
FROM golang:1.24-alpine AS builder2
|
||||
FROM --platform=$BUILDPLATFORM golang:1.24-alpine AS builder2
|
||||
|
||||
ARG VERSION=1.0.0
|
||||
ARG TARGETOS
|
||||
ARG TARGETARCH
|
||||
ENV GO111MODULE=on \
|
||||
CGO_ENABLED=0 \
|
||||
GOOS=linux
|
||||
CGO_ENABLED=0
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
ADD go.mod go.sum ./
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
COPY . .
|
||||
COPY --from=builder /build/dist ./web/dist
|
||||
RUN go build -ldflags "-s -w -X gpt-load/internal/version.Version=${VERSION}" -o gpt-load
|
||||
RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags "-s -w -X gpt-load/internal/version.Version=${VERSION}" -o gpt-load
|
||||
|
||||
|
||||
FROM alpine
|
||||
|
||||
WORKDIR /app
|
||||
RUN apk upgrade --no-cache \
|
||||
&& apk add --no-cache ca-certificates tzdata \
|
||||
RUN apk add --no-cache ca-certificates tzdata \
|
||||
&& update-ca-certificates
|
||||
|
||||
COPY --from=builder2 /build/gpt-load .
|
||||
|
||||
Reference in new issue
Block a user