mirror of
https://github.com/icereed/paperless-gpt.git
synced 2025-03-13 05:08:01 -05:00
Adjust Dockerfile to run OCR
This commit is contained in:
parent
2b436a2ab2
commit
aafb6d65d1
1 changed files with 20 additions and 9 deletions
29
Dockerfile
29
Dockerfile
|
@ -1,9 +1,17 @@
|
||||||
# Stage 1: Build the Go binary
|
# Stage 1: Build the Go binary
|
||||||
FROM golang:1.22 AS builder
|
FROM golang:1.22-alpine AS builder
|
||||||
|
|
||||||
# Set the working directory inside the container
|
# Set the working directory inside the container
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Install necessary packages
|
||||||
|
RUN apk add --no-cache \
|
||||||
|
git \
|
||||||
|
gcc \
|
||||||
|
musl-dev \
|
||||||
|
mupdf \
|
||||||
|
mupdf-dev
|
||||||
|
|
||||||
# Copy go.mod and go.sum files
|
# Copy go.mod and go.sum files
|
||||||
COPY go.mod go.sum ./
|
COPY go.mod go.sum ./
|
||||||
|
|
||||||
|
@ -13,17 +21,19 @@ RUN go mod download
|
||||||
# Copy the rest of the application code
|
# Copy the rest of the application code
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Build the Go binary
|
# Build the Go binary with the musl build tag
|
||||||
RUN CGO_ENABLED=0 GOOS=linux go build -o paperless-gpt .
|
RUN go build -tags musl -o paperless-gpt .
|
||||||
|
|
||||||
# Stage 2: Build Vite frontend
|
# Stage 2: Build Vite frontend
|
||||||
FROM node:20 AS frontend
|
FROM node:20-alpine AS frontend
|
||||||
|
|
||||||
# Set the working directory inside the container
|
# Set the working directory inside the container
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy package.json and package-lock.json
|
# Install necessary packages
|
||||||
|
RUN apk add --no-cache git
|
||||||
|
|
||||||
|
# Copy package.json and package-lock.json
|
||||||
COPY web-app/package.json web-app/package-lock.json ./
|
COPY web-app/package.json web-app/package-lock.json ./
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
|
@ -35,11 +45,12 @@ COPY web-app /app/
|
||||||
# Build the frontend
|
# Build the frontend
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
# Stage 3: Create a lightweight image with the Go binary
|
# Stage 3: Create a lightweight image with the Go binary and frontend
|
||||||
FROM alpine:latest
|
FROM alpine:latest
|
||||||
|
|
||||||
# Install necessary CA certificates
|
# Install necessary runtime dependencies
|
||||||
RUN apk --no-cache add ca-certificates mupdf-dev
|
RUN apk add --no-cache \
|
||||||
|
ca-certificates
|
||||||
|
|
||||||
# Set the working directory inside the container
|
# Set the working directory inside the container
|
||||||
WORKDIR /app/
|
WORKDIR /app/
|
||||||
|
@ -54,4 +65,4 @@ COPY --from=frontend /app/dist /app/web-app/dist
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
||||||
# Command to run the binary
|
# Command to run the binary
|
||||||
CMD ["./paperless-gpt"]
|
CMD ["/app/paperless-gpt"]
|
||||||
|
|
Loading…
Reference in a new issue