1
Fork 0

Make Dockerfile build sqlite dependency without errors

This commit is contained in:
viktorstrate 2021-01-17 15:59:08 +01:00
parent f0bc9fec0c
commit 9098bf38d1
No known key found for this signature in database
GPG Key ID: 3F855605109C1E8A
1 changed files with 13 additions and 5 deletions

View File

@ -1,4 +1,4 @@
# Build UI
### Build UI ###
FROM --platform=${BUILDPLATFORM:-linux/amd64} node:10 as ui
ARG PHOTOVIEW_API_ENDPOINT
@ -19,8 +19,12 @@ COPY ui /app
# Build frontend
RUN npm run build -- --public-url $UI_PUBLIC_URL
# Build API
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.14-alpine AS api
### Build API ###
FROM --platform=${BUILDPLATFORM:-linux/amd64} alpine:3 AS api
# Install required build dependencies
RUN apk --no-cache add go build-base
COPY --from=tonistiigi/xx:golang / /
ARG TARGETPLATFORM
@ -33,13 +37,17 @@ WORKDIR /app
COPY api/go.mod api/go.sum /app/
RUN go mod download
# Build go-sqlite3 dependency with CGO
ENV CGO_ENABLED 1
RUN go install github.com/mattn/go-sqlite3
# Copy api source
COPY api /app
RUN go build -v -o photoview .
# Copy api and ui to production environment
FROM alpine:3.12
### Copy api and ui to production environment ###
FROM alpine:3
# Install darktable for converting RAW images, and ffmpeg for encoding videos
# Ignore errors if packages are not supported for the specific platform