You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
memos/Dockerfile

40 lines
867 B
Docker

3 years ago
# Build frontend dist.
FROM node:18.12.1-alpine3.16 AS frontend
3 years ago
WORKDIR /frontend-build
COPY ./web/package.json ./web/pnpm-lock.yaml ./
RUN corepack enable && pnpm i --frozen-lockfile
3 years ago
COPY ./web/ .
RUN pnpm build
3 years ago
# Build backend exec file.
FROM golang:1.19.3-alpine3.16 AS backend
3 years ago
WORKDIR /backend-build
RUN apk update && apk add --no-cache gcc musl-dev
3 years ago
3 years ago
COPY . .
COPY --from=frontend /frontend-build/dist ./server/dist
3 years ago
RUN go build -o memos ./main.go
3 years ago
# Make workspace with above generated files.
FROM alpine:3.16 AS monolithic
3 years ago
WORKDIR /usr/local/memos
RUN apk add --no-cache tzdata
ENV TZ="UTC"
3 years ago
COPY --from=backend /backend-build/memos /usr/local/memos/
EXPOSE 5230
# Directory to store the data, which can be referenced as the mounting point.
RUN mkdir -p /var/opt/memos
VOLUME /var/opt/memos
3 years ago
ENTRYPOINT ["./memos", "--mode", "prod", "--port", "5230"]