Dockerfile: build on our images

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2023-11-10 08:17:54 -05:00
parent 0995478cc0
commit 92b4c63792
Signed by: vbatts
GPG key ID: E30EFAA812C6E5ED

View file

@ -1,6 +1,6 @@
# Build Nuxt
FROM node:18-alpine as frontend-builder
FROM r.batts.cloud/node:18 as frontend-builder
WORKDIR /app
RUN npm install -g pnpm
COPY frontend/package.json frontend/pnpm-lock.yaml ./
@ -9,13 +9,12 @@ COPY frontend .
RUN pnpm build
# Build API
FROM golang:alpine AS builder
FROM r.batts.cloud/golang:1.21 AS builder
ARG BUILD_TIME
ARG COMMIT
ARG VERSION
RUN apk update && \
apk upgrade && \
apk add --update git build-base gcc g++
RUN apt update && \
apt install -y git build-essential gcc g++
WORKDIR /go/src/app
COPY ./backend .
@ -28,13 +27,12 @@ RUN CGO_ENABLED=0 GOOS=linux go build \
-v ./app/api/*.go
# Production Stage
FROM alpine:latest
FROM r.batts.cloud/debian:bookworm
ENV HBOX_MODE=production
ENV HBOX_STORAGE_DATA=/data/
ENV HBOX_STORAGE_SQLITE_URL=/data/homebox.db?_fk=1
RUN apk --no-cache add ca-certificates
RUN mkdir /app
COPY --from=builder /go/bin/api /app