finalized Dockerfile

This commit is contained in:
jc 2024-04-04 02:37:23 -04:00
commit 3534cbf3cd
No known key found for this signature in database
2 changed files with 35 additions and 0 deletions

6
.dockerignore Normal file
View file

@ -0,0 +1,6 @@
node_modules
.git
.gitignore
*.md
build
tmp

29
Dockerfile Normal file
View file

@ -0,0 +1,29 @@
FROM node:20-alpine AS styles
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
COPY . /app
WORKDIR /app
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
RUN pnpm run tw:prod
FROM golang:1.22.0 as builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY *.go ./
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o ./build/potoforio .
FROM alpine as runner
WORKDIR /go
COPY --from=builder /app/build/potoforio ./
COPY --from=styles /app/static ./static
COPY --from=styles /app/views ./views
EXPOSE 5173
ENV GO_ENV="production"
ENTRYPOINT ["./potoforio"]