wikijs/Dockerfile

55 lines
1.5 KiB
Docker

FROM alpine:3.15 as builder
RUN apk add --no-cache \
git \
npm \
bash \
python3 \
make \
sed
#ENV NODE_ENV=production
# to get around errors from differing stack sizes in musl
# https://wiki.musl-libc.org/functional-differences-from-glibc.html#Thread_stack_size
RUN npm config set unsafe-perm true
RUN npm install -g \
webpack \
webpack-cli \
node-gyp
ENV WIKIJS_VERSION=v2.5.285
RUN git clone https://github.com/Requarks/wiki.git -b $WIKIJS_VERSION /build
WORKDIR /build
RUN npm install --legacy-peer-deps
# don't know why this is needed here too, but what the hell
RUN npm install --save-dev webpack webpack-cli
RUN npx webpack --profile --config dev/webpack/webpack.prod.js
RUN sed -i '0,/.*"dev".*/s//"dev": false,/' package.json
FROM thallian/confd-env:latest
ENV NODE_ENV=production
RUN addgroup -g 2222 wikijs
RUN adduser -h /home/wikijs -S -D -u 2222 -G wikijs wikijs
COPY --from=builder --chown=wikijs:wikijs /build/assets /home/wikijs/assets
COPY --from=builder --chown=wikijs:wikijs /build/node_modules /home/wikijs/node_modules
COPY --from=builder --chown=wikijs:wikijs /build/server /home/wikijs/server
COPY --from=builder --chown=wikijs:wikijs /build/LICENSE /home/wikijs/LICENSE
COPY --from=builder --chown=wikijs:wikijs /build/config.sample.yml /home/wikijs/config.sample.yml
COPY --from=builder --chown=wikijs:wikijs /build/package.json /home/wikijs/package.json
RUN apk add --no-cache \
nodejs \
git \
openssh-client
ADD /rootfs /
VOLUME [ "/home/wikijs/data" ]
EXPOSE 3000