Armin Friedl
7aaea2ed2f
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.
28 lines
652 B
Docker
28 lines
652 B
Docker
FROM node:current-alpine
|
|
|
|
ARG HASTEBIN_VERSION
|
|
ENV UID=1005 GID=1005
|
|
|
|
COPY run.sh /usr/local/bin/run.sh
|
|
|
|
RUN apk -U upgrade \
|
|
&& apk --no-cache add git su-exec \
|
|
&& git clone --depth 1 https://github.com/seejohnrun/haste-server.git /app \
|
|
&& cd app \
|
|
&& git checkout ${HASTEBIN_VERSION} \
|
|
&& npm install \
|
|
&& npm cache clean --force \
|
|
&& mkdir /.npm \
|
|
&& apk del git \
|
|
&& rm -rf /var/lib/apk/* /var/cache/apk/* \
|
|
&& chmod +x /usr/local/bin/run.sh
|
|
|
|
# we cannot copy this before the RUN because
|
|
# git clone will fail if app/ is not empty
|
|
COPY config.js /app/config.js
|
|
|
|
WORKDIR /app
|
|
VOLUME /app/data
|
|
EXPOSE 7777
|
|
|
|
ENTRYPOINT ["run.sh"]
|