mirror of
https://github.com/wekan/wekan.git
synced 2025-09-22 01:50:48 +02:00
Dockerfile: Switch RUN commands to heredoc to avoid an insane amount of ANDs and escapes
This commit is contained in:
parent
dfe4f7bb56
commit
28612bbc8a
1 changed files with 86 additions and 87 deletions
173
Dockerfile
173
Dockerfile
|
@ -176,93 +176,92 @@ ENV BUILD_DEPS="apt-utils libarchive-tools gnupg gosu wget curl bzip2 g++ build-
|
||||||
# Copy the app to the image
|
# Copy the app to the image
|
||||||
COPY ${SRC_PATH} /home/wekan/app
|
COPY ${SRC_PATH} /home/wekan/app
|
||||||
|
|
||||||
RUN \
|
RUN <<EOR
|
||||||
set -o xtrace && \
|
set -o xtrace
|
||||||
# Add non-root user wekan
|
# Add non-root user wekan
|
||||||
useradd --user-group --system --home-dir /home/wekan wekan && \
|
useradd --user-group --system --home-dir /home/wekan wekan
|
||||||
\
|
# OS dependencies
|
||||||
# OS dependencies
|
apt-get update -y
|
||||||
apt-get update -y && apt-get install -y --no-install-recommends ${BUILD_DEPS} && \
|
apt-get install -y --no-install-recommends ${BUILD_DEPS}
|
||||||
\
|
# Meteor installer doesn't work with the default tar binary, so using bsdtar while installing.
|
||||||
# Meteor installer doesn't work with the default tar binary, so using bsdtar while installing.
|
# https://github.com/coreos/bugs/issues/1095#issuecomment-350574389
|
||||||
# https://github.com/coreos/bugs/issues/1095#issuecomment-350574389
|
cp $(which tar) $(which tar)~
|
||||||
cp $(which tar) $(which tar)~ && \
|
ln -sf $(which bsdtar) $(which tar)
|
||||||
ln -sf $(which bsdtar) $(which tar) && \
|
# Download nodejs
|
||||||
\
|
wget https://github.com/wekan/node-v14-esm/releases/download/${NODE_VERSION}/node-${NODE_VERSION}-${ARCHITECTURE}.tar.gz
|
||||||
# Download nodejs
|
wget https://github.com/wekan/node-v14-esm/releases/download/${NODE_VERSION}/SHASUMS256.txt
|
||||||
wget https://github.com/wekan/node-v14-esm/releases/download/${NODE_VERSION}/node-${NODE_VERSION}-${ARCHITECTURE}.tar.gz && \
|
#wget https://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERSION}-${ARCHITECTURE}.tar.gz
|
||||||
wget https://github.com/wekan/node-v14-esm/releases/download/${NODE_VERSION}/SHASUMS256.txt && \
|
#wget https://nodejs.org/dist/${NODE_VERSION}/SHASUMS256.txt.asc
|
||||||
#wget https://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERSION}-${ARCHITECTURE}.tar.gz && \
|
#---------------------------------------------------------------------------------------------
|
||||||
#wget https://nodejs.org/dist/${NODE_VERSION}/SHASUMS256.txt.asc && \
|
|
||||||
#---------------------------------------------------------------------------------------------
|
# Verify nodejs authenticity
|
||||||
\
|
grep node-${NODE_VERSION}-${ARCHITECTURE}.tar.gz SHASUMS256.txt | shasum -a 256 -c -
|
||||||
# Verify nodejs authenticity
|
rm -f SHASUMS256.txt
|
||||||
grep node-${NODE_VERSION}-${ARCHITECTURE}.tar.gz SHASUMS256.txt | shasum -a 256 -c - && \
|
#grep ${NODE_VERSION}-${ARCHITECTURE}.tar.gz SHASUMS256.txt.asc | shasum -a 256 -c -
|
||||||
rm -f SHASUMS256.txt && \
|
#rm -f SHASUMS256.txt.asc
|
||||||
#grep ${NODE_VERSION}-${ARCHITECTURE}.tar.gz SHASUMS256.txt.asc | shasum -a 256 -c - && \
|
|
||||||
#rm -f SHASUMS256.txt.asc && \
|
# Install Node
|
||||||
\
|
tar xvzf node-${NODE_VERSION}-${ARCHITECTURE}.tar.gz
|
||||||
# Install Node
|
rm node-${NODE_VERSION}-${ARCHITECTURE}.tar.gz
|
||||||
tar xvzf node-${NODE_VERSION}-${ARCHITECTURE}.tar.gz && \
|
mv node-${NODE_VERSION}-${ARCHITECTURE} /opt/nodejs
|
||||||
rm node-${NODE_VERSION}-${ARCHITECTURE}.tar.gz && \
|
ln -s /opt/nodejs/bin/node /usr/bin/node
|
||||||
mv node-${NODE_VERSION}-${ARCHITECTURE} /opt/nodejs && \
|
ln -s /opt/nodejs/bin/npm /usr/bin/npm
|
||||||
ln -s /opt/nodejs/bin/node /usr/bin/node && \
|
mkdir -p /opt/nodejs/lib/node_modules/fibers/.node-gyp /root/.node-gyp/${NODE_VERSION} /home/wekan/.config
|
||||||
ln -s /opt/nodejs/bin/npm /usr/bin/npm && \
|
chown wekan --recursive /home/wekan/.config
|
||||||
mkdir -p /opt/nodejs/lib/node_modules/fibers/.node-gyp /root/.node-gyp/${NODE_VERSION} /home/wekan/.config && \
|
|
||||||
chown wekan --recursive /home/wekan/.config && \
|
#DOES NOT WORK: paxctl fix for alpine linux: https://github.com/wekan/wekan/issues/1303
|
||||||
\
|
#paxctl -mC `which node`
|
||||||
#DOES NOT WORK: paxctl fix for alpine linux: https://github.com/wekan/wekan/issues/1303
|
|
||||||
#paxctl -mC `which node` && \
|
# Install Node dependencies. Python path for node-gyp.
|
||||||
\
|
#npm install -g npm@${NPM_VERSION}
|
||||||
# Install Node dependencies. Python path for node-gyp.
|
|
||||||
#npm install -g npm@${NPM_VERSION} && \
|
# Change user to wekan and install meteor
|
||||||
\
|
cd /home/wekan/
|
||||||
# Change user to wekan and install meteor
|
chown wekan --recursive /home/wekan
|
||||||
cd /home/wekan/ && \
|
echo "Starting meteor ${METEOR_RELEASE} installation... \n"
|
||||||
chown wekan --recursive /home/wekan && \
|
gosu wekan:wekan curl https://install.meteor.com/ | /bin/sh
|
||||||
echo "Starting meteor ${METEOR_RELEASE} installation... \n" && \
|
mv /root/.meteor /home/wekan/
|
||||||
gosu wekan:wekan curl https://install.meteor.com/ | /bin/sh && \
|
chown wekan --recursive /home/wekan/.meteor
|
||||||
mv /root/.meteor /home/wekan/ && \
|
|
||||||
chown wekan --recursive /home/wekan/.meteor && \
|
sed -i 's/api\.versionsFrom/\/\/api.versionsFrom/' /home/wekan/app/packages/meteor-useraccounts-core/package.js
|
||||||
\
|
cd /home/wekan/.meteor
|
||||||
sed -i 's/api\.versionsFrom/\/\/api.versionsFrom/' /home/wekan/app/packages/meteor-useraccounts-core/package.js && \
|
gosu wekan:wekan /home/wekan/.meteor/meteor -- help;
|
||||||
cd /home/wekan/.meteor && \
|
|
||||||
gosu wekan:wekan /home/wekan/.meteor/meteor -- help; \
|
# Build app
|
||||||
\
|
cd /home/wekan/app
|
||||||
# Build app
|
mkdir -p /home/wekan/.npm
|
||||||
cd /home/wekan/app && \
|
chown wekan --recursive /home/wekan/.npm /home/wekan/.config /home/wekan/.meteor
|
||||||
mkdir -p /home/wekan/.npm && \
|
chmod u+w *.json
|
||||||
chown wekan --recursive /home/wekan/.npm /home/wekan/.config /home/wekan/.meteor && \
|
gosu wekan:wekan meteor npm install
|
||||||
chmod u+w *.json && \
|
gosu wekan:wekan /home/wekan/.meteor/meteor build --directory /home/wekan/app_build
|
||||||
gosu wekan:wekan meteor npm install && \
|
cd /home/wekan/app_build/bundle/programs/server/
|
||||||
gosu wekan:wekan /home/wekan/.meteor/meteor build --directory /home/wekan/app_build && \
|
chmod u+w *.json
|
||||||
cd /home/wekan/app_build/bundle/programs/server/ && \
|
gosu wekan:wekan meteor npm install
|
||||||
chmod u+w *.json && \
|
cd node_modules/fibers
|
||||||
gosu wekan:wekan meteor npm install && \
|
node build.js
|
||||||
cd node_modules/fibers && \
|
cd ../..
|
||||||
node build.js && \
|
# Remove legacy webbroser bundle, so that Wekan works also at Android Firefox, iOS Safari, etc.
|
||||||
cd ../.. && \
|
rm -rf /home/wekan/app_build/bundle/programs/web.browser.legacy
|
||||||
# Remove legacy webbroser bundle, so that Wekan works also at Android Firefox, iOS Safari, etc.
|
mv /home/wekan/app_build/bundle /build
|
||||||
rm -rf /home/wekan/app_build/bundle/programs/web.browser.legacy && \
|
|
||||||
mv /home/wekan/app_build/bundle /build && \
|
# Put back the original tar
|
||||||
\
|
mv $(which tar)~ $(which tar)
|
||||||
# Put back the original tar
|
|
||||||
mv $(which tar)~ $(which tar) && \
|
# Cleanup
|
||||||
\
|
apt-get remove --purge -y ${BUILD_DEPS}
|
||||||
# Cleanup
|
apt-get autoremove -y
|
||||||
apt-get remove --purge -y ${BUILD_DEPS} && \
|
npm uninstall -g api2html
|
||||||
apt-get autoremove -y && \
|
rm -R /tmp/*
|
||||||
npm uninstall -g api2html &&\
|
rm -R /var/lib/apt/lists/*
|
||||||
rm -R /tmp/* && \
|
rm -R /home/wekan/.meteor
|
||||||
rm -R /var/lib/apt/lists/* && \
|
rm -R /home/wekan/app
|
||||||
rm -R /home/wekan/.meteor && \
|
rm -R /home/wekan/app_build
|
||||||
rm -R /home/wekan/app && \
|
mkdir /data
|
||||||
rm -R /home/wekan/app_build && \
|
chown wekan --recursive /data
|
||||||
mkdir /data && \
|
#cat /home/wekan/python/esprima-python/files.txt | xargs rm -R
|
||||||
chown wekan --recursive /data
|
#rm -R /home/wekan/python
|
||||||
#cat /home/wekan/python/esprima-python/files.txt | xargs rm -R && \
|
#rm /home/wekan/install_meteor.sh
|
||||||
#rm -R /home/wekan/python
|
EOR
|
||||||
#rm /home/wekan/install_meteor.sh
|
|
||||||
|
|
||||||
ENV PORT=8080
|
ENV PORT=8080
|
||||||
EXPOSE $PORT
|
EXPOSE $PORT
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue