Port to alpine, pin version

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2018-10-10 13:06:27 +02:00
parent 1970ee48e2
commit 56867e6eed
Signed by: luzifer
GPG Key ID: DC2729FDD34BE99E
2 changed files with 39 additions and 18 deletions

View File

@ -1,6 +1,33 @@
FROM node:7
FROM node:7-alpine as builder
ENV VERSION master
ARG CODIMD_VERSION=1.2.1
ARG BUILD_ASSETS=false
RUN set -ex \
&& apk add --no-cache \
bash \
build-base \
curl \
git \
make \
python \
tar \
&& mkdir /hackmd \
&& curl -sSfL https://github.com/hackmdio/codimd/archive/${CODIMD_VERSION}.tar.gz | tar -xzf - --strip-components=1 -C /hackmd \
&& cd /hackmd \
&& npm install --loglevel warn \
grunt \
webpack \
webpack-cli \
&& npm install --loglevel warn \
&& npm run build \
&& rm -rf node_modules \
&& NODE_ENV=production npm install --loglevel warn
FROM node:7-alpine
LABEL codimd_version=1.2.1
# ENV DEBUG true
# ENV HMD_DOMAIN localhost
@ -47,17 +74,11 @@ ENV VERSION master
# ENV HMD_S3_BUCKET ""
RUN set -ex \
&& mkdir /hackmd \
&& curl -sSfL https://github.com/hackmdio/hackmd/archive/${VERSION}.tar.gz | tar -xzf - --strip-components=1 -C /hackmd
&& apk add --no-cache bash
WORKDIR /hackmd
COPY --from=builder /hackmd /hackmd
RUN set -ex \
&& npm install webpack \
&& npm install \
&& npm run build
ADD run.sh /usr/local/bin/run.sh
ADD run.sh /usr/local/bin/run.sh
ADD config.json /hackmd/config.json.default
ADD sequelizerc /hackmd/.sequelizerc.default

14
run.sh
View File

@ -1,22 +1,22 @@
#!/bin/bash
set -euxo pipefail
set -o pipefail
set -ex
cd /hackmd
if ! [ -f /config/config.json ]; then
cp config.json.default config.json
cp config.json.default config.json
else
cp /config/config.json config.json
cp /config/config.json config.json
fi
if ! [ -f /config/.sequelizerc ]; then
cp .sequelizerc.default .sequelizerc
cp .sequelizerc.default .sequelizerc
else
cp /config/.sequelizerc .sequelizerc
cp /config/.sequelizerc .sequelizerc
fi
if [ -f /config/client_config.js ]; then
cp /config/client_config.js public/js/config.js
cp /config/client_config.js public/js/config.js
fi
node_modules/.bin/sequelize db:migrate