Dockerfile 1.38 KB
Newer Older
1 2 3
# ====================
# --- Build Assets ---
# ====================
4
FROM node:14-alpine AS assets
5

6
RUN apk add yarn g++ make python --no-cache
7

8
WORKDIR /wiki
9

10
COPY ./client ./client
11 12 13 14 15
COPY ./dev ./dev
COPY ./package.json ./package.json
COPY ./.babelrc ./.babelrc
COPY ./.eslintignore ./.eslintignore
COPY ./.eslintrc.yml ./.eslintrc.yml
16

Nick's avatar
Nick committed
17 18
RUN yarn cache clean
RUN yarn --frozen-lockfile --non-interactive
19
RUN yarn build
20
RUN rm -rf /wiki/node_modules
Nick's avatar
Nick committed
21
RUN yarn --production --frozen-lockfile --non-interactive
22 23 24 25

# ===============
# --- Release ---
# ===============
26
FROM node:14-alpine
27 28
LABEL maintainer="requarks.io"

29
RUN apk add bash curl git openssh gnupg sqlite --no-cache && \
30
    mkdir -p /wiki && \
31
    mkdir -p /logs && \
NGPixel's avatar
NGPixel committed
32
    mkdir -p /wiki/data/content && \
33
    chown -R node:node /wiki /logs
34

35
WORKDIR /wiki
36

37 38 39 40 41 42 43 44 45
COPY --chown=node:node --from=assets /wiki/assets ./assets
COPY --chown=node:node --from=assets /wiki/node_modules ./node_modules
COPY --chown=node:node ./server ./server
COPY --chown=node:node --from=assets /wiki/server/views ./server/views
COPY --chown=node:node ./dev/build/config.yml ./config.yml
COPY --chown=node:node ./package.json ./package.json
COPY --chown=node:node ./LICENSE ./LICENSE

USER node
46

NGPixel's avatar
NGPixel committed
47 48
VOLUME ["/wiki/data/content"]

49
EXPOSE 3000
NGPixel's avatar
NGPixel committed
50
EXPOSE 3443
51

NGPixel's avatar
NGPixel committed
52
# HEALTHCHECK --interval=30s --timeout=30s --start-period=30s --retries=3 CMD curl -f http://localhost:3000/healthz
Nick's avatar
Nick committed
53

54
CMD ["node", "server"]