43 lines
986 B
Plaintext
43 lines
986 B
Plaintext
# syntax=docker/dockerfile:1
|
|
FROM node:20-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Install dependencies
|
|
COPY ./package*.json .
|
|
COPY ./yarn.lock .
|
|
ENV NODE_ENV='development'
|
|
RUN yarn install --production=false --frozen-lockfile
|
|
|
|
COPY . .
|
|
|
|
ENV VITE_COMMIT_HASH=""
|
|
ENV VITE_APP_VERSION="custom"
|
|
RUN yarn build
|
|
|
|
# FROM nginx:stable-alpine-slim AS main
|
|
FROM node:20-alpine AS main
|
|
EXPOSE 80
|
|
|
|
# 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
|
|
|
|
ENTRYPOINT ["/app/docker-entrypoint.sh"]
|