Fix cache directory permissions
Newer npm expects a cache directory under `/.npm`. We cleaned the cache and npm cannot create the directory anymore at runtime (we drop privileges). So we have to create the `/.npm` directory again during container build and later re-own it. In `run.sh` re-own `/.npm` so it is accessible when we later drop privileges.
This commit is contained in:
parent
4612c8fcf5
commit
7aaea2ed2f
4 changed files with 6 additions and 0 deletions
|
@ -12,6 +12,7 @@ RUN apk -U upgrade \
|
||||||
&& git checkout ${HASTEBIN_VERSION} \
|
&& git checkout ${HASTEBIN_VERSION} \
|
||||||
&& npm install \
|
&& npm install \
|
||||||
&& npm cache clean --force \
|
&& npm cache clean --force \
|
||||||
|
&& mkdir /.npm \
|
||||||
&& apk del git \
|
&& apk del git \
|
||||||
&& rm -rf /var/lib/apk/* /var/cache/apk/* \
|
&& rm -rf /var/lib/apk/* /var/cache/apk/* \
|
||||||
&& chmod +x /usr/local/bin/run.sh
|
&& chmod +x /usr/local/bin/run.sh
|
||||||
|
|
|
@ -5,4 +5,6 @@ set -xe
|
||||||
# we have to run the chown here since the VOLUME is mounted
|
# we have to run the chown here since the VOLUME is mounted
|
||||||
# after the build with root:root
|
# after the build with root:root
|
||||||
chown -R ${UID}:${GID} /app
|
chown -R ${UID}:${GID} /app
|
||||||
|
chown -R ${UID}:${GID} /.npm
|
||||||
|
|
||||||
su-exec ${UID}:${GID} npm start
|
su-exec ${UID}:${GID} npm start
|
||||||
|
|
|
@ -12,6 +12,7 @@ RUN apk -U upgrade \
|
||||||
&& git checkout ${HASTEBIN_VERSION} \
|
&& git checkout ${HASTEBIN_VERSION} \
|
||||||
&& npm install \
|
&& npm install \
|
||||||
&& npm cache clean --force \
|
&& npm cache clean --force \
|
||||||
|
&& mkdir /.npm \
|
||||||
&& apk del git \
|
&& apk del git \
|
||||||
&& rm -rf /var/lib/apk/* /var/cache/apk/* \
|
&& rm -rf /var/lib/apk/* /var/cache/apk/* \
|
||||||
&& chmod +x /usr/local/bin/run.sh
|
&& chmod +x /usr/local/bin/run.sh
|
||||||
|
|
|
@ -5,4 +5,6 @@ set -xe
|
||||||
# we have to run the chown here since the VOLUME is mounted
|
# we have to run the chown here since the VOLUME is mounted
|
||||||
# after the build with root:root
|
# after the build with root:root
|
||||||
chown -R ${UID}:${GID} /app
|
chown -R ${UID}:${GID} /app
|
||||||
|
chown -R ${UID}:${GID} /.npm
|
||||||
|
|
||||||
su-exec ${UID}:${GID} npm start
|
su-exec ${UID}:${GID} npm start
|
||||||
|
|
Loading…
Reference in a new issue