wikijs-fork/dev/build/Dockerfile

82 lines
1.9 KiB
Docker
Raw Normal View History

2018-11-04 02:07:00 +00:00
# ====================
# --- Build Assets ---
# ====================
2019-01-18 20:58:39 +00:00
FROM node:10.15-alpine AS assets
2018-11-04 02:07:00 +00:00
RUN apk update && \
apk add yarn g++ make python --no-cache && \
rm -rf /var/cache/apk/* && \
2019-01-18 20:58:39 +00:00
mkdir -p /wiki
2018-11-04 02:07:00 +00:00
2019-01-18 20:58:39 +00:00
WORKDIR /wiki
2018-11-04 02:07:00 +00:00
2018-11-04 02:15:49 +00:00
COPY ./client ./client
COPY ./dev ./dev
COPY ./package.json ./package.json
COPY ./.babelrc ./.babelrc
COPY ./.eslintignore ./.eslintignore
COPY ./.eslintrc.yml ./.eslintrc.yml
2018-11-04 02:07:00 +00:00
2018-11-04 18:19:49 +00:00
RUN yarn --cache-folder /codefresh/volume/yarn
2018-11-04 02:07:00 +00:00
RUN yarn build
2019-01-18 20:58:39 +00:00
RUN rm -rf /wiki/node_modules
2018-11-04 02:07:00 +00:00
RUN yarn --production
2019-01-19 03:47:17 +00:00
# =========================
# --- Publish to GitHub ---
# =========================
FROM alpine AS publishing
RUN apk --update add git jq openssh hub tar && \
rm -rf /var/cache/apk/*
WORKDIR /wiki
COPY --from=assets /wiki/assets ./assets
COPY --from=assets /wiki/node_modules ./node_modules
COPY ./server ./server
COPY --from=assets /wiki/server/views ./server/views
COPY ./config.sample.yml ./config.sample.yml
COPY ./package.json ./package.json
COPY ./LICENSE ./LICENSE
RUN BUILDNUM=$(jq -r '.version' package.json)
WORKDIR /
RUN tar -czf wiki-js.tar.gz /wiki
RUN mv wiki-js.tar.gz /wiki
WORKDIR /wiki
RUN hub init -g "Requarks/wiki"
RUN hub create -p -a wiki-js.tar.gz -m "See [CHANGELOG](https://github.com/Requarks/wiki/blob/master/CHANGELOG.md) for release notes" -t $CF_REVISION $BUILDNUM
2018-11-04 02:07:00 +00:00
# ===============
# --- Release ---
# ===============
2019-01-18 20:58:39 +00:00
FROM node:10.15-alpine
2017-10-15 03:56:51 +00:00
LABEL maintainer="requarks.io"
RUN apk update && \
apk add bash curl git openssh supervisor --no-cache && \
2018-11-04 02:07:00 +00:00
rm -rf /var/cache/apk/* && \
2019-01-18 20:58:39 +00:00
mkdir -p /wiki && \
2018-11-04 18:14:09 +00:00
mkdir -p /logs
2017-10-15 03:56:51 +00:00
2019-01-18 20:58:39 +00:00
WORKDIR /wiki
2017-10-15 03:56:51 +00:00
2019-01-18 20:58:39 +00:00
COPY --from=assets /wiki/assets ./assets
COPY --from=assets /wiki/node_modules ./node_modules
2018-11-04 02:15:49 +00:00
COPY ./server ./server
2019-01-18 20:58:39 +00:00
COPY --from=assets /wiki/server/views ./server/views
2018-11-04 17:55:21 +00:00
COPY ./dev/build/config.yml ./config.yml
2018-12-09 01:51:55 +00:00
COPY ./dev/docker/wait.sh ./wait.sh
2018-11-04 02:15:49 +00:00
COPY ./package.json ./package.json
COPY ./LICENSE ./LICENSE
2017-10-15 03:56:51 +00:00
EXPOSE 3000
2019-01-18 20:58:39 +00:00
CMD ["node", "server"]