nostrudel/server/dockerfile
hzrd149 962ba25364 Use applesauce-core for NIP-28 channels
Refresh relay info on relay page
Switch to pnpm
2024-09-28 11:01:29 -05:00

53 lines
1.2 KiB
Plaintext

# syntax=docker/dockerfile:1
FROM node:20-alpine AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
WORKDIR /app
COPY ./package*.json .
COPY ./pnpm-lock.yaml .
FROM base AS prod-deps
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
FROM base AS build
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
ENV VITE_COMMIT_HASH=""
ENV VITE_APP_VERSION="Custom"
COPY tsconfig.json .
COPY public ./public
COPY src ./src
RUN pnpm build
# FROM nginx:stable-alpine-slim AS main
FROM base AS main
# install tor
# copied from https://github.com/klemmchr/tor-alpine/blob/master/Dockerfile
RUN echo '@edge https://dl-cdn.alpinelinux.org/alpine/edge/community' >> /etc/apk/repositories && \
apk -U upgrade && \
apk -v add tor@edge torsocks@edge
# remove tmp files
RUN rm -rf /var/cache/apk/* /tmp/* /var/tmp/*
WORKDIR /app
COPY --from=builder /app/dist /usr/share/nginx/html
# copy server
COPY server/ /app/server/
RUN cd /app/server/ && npm install
# setup entrypoint
ADD ./docker-entrypoint.sh docker-entrypoint.sh
RUN chmod a+x docker-entrypoint.sh
EXPOSE 80
ENTRYPOINT ["/app/docker-entrypoint.sh"]