2023-05-28 13:41:31 +00:00
|
|
|
# frontend
|
2023-05-30 17:32:52 +00:00
|
|
|
FROM node:20-slim as frontend
|
2023-05-28 13:41:31 +00:00
|
|
|
RUN corepack enable
|
|
|
|
RUN corepack prepare pnpm@latest --activate
|
|
|
|
WORKDIR /app
|
|
|
|
COPY frontend/package.json frontend/pnpm-lock.yaml ./
|
|
|
|
RUN pnpm install --frozen-lockfile
|
|
|
|
COPY frontend/ ./
|
|
|
|
RUN pnpm build
|
|
|
|
|
|
|
|
# backend
|
2024-02-07 07:31:02 +00:00
|
|
|
FROM golang:1.22-alpine as backend
|
2023-05-28 13:41:31 +00:00
|
|
|
WORKDIR /app
|
|
|
|
COPY . .
|
|
|
|
RUN rm -rf frontend
|
|
|
|
COPY --from=frontend /app/ ./frontend
|
|
|
|
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags='-w -s -extldflags "-static"' -a -o medium
|
|
|
|
|
|
|
|
# final
|
|
|
|
FROM debian:bullseye-slim
|
|
|
|
RUN apt-get update && apt-get install -y ca-certificates
|
|
|
|
COPY --from=backend /app/medium /usr/local/bin/medium
|
|
|
|
CMD [ "medium" ]
|