Fix Docker volume permissions for backend runtime
This commit is contained in:
@@ -5,16 +5,18 @@ ENV NODE_ENV=production
|
||||
WORKDIR /app
|
||||
|
||||
COPY package*.json ./
|
||||
RUN apk add --no-cache curl && npm install --omit=dev
|
||||
RUN apk add --no-cache curl su-exec && npm install --omit=dev
|
||||
|
||||
COPY . .
|
||||
RUN chown -R node:node /app
|
||||
|
||||
USER node
|
||||
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
|
||||
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
||||
|
||||
EXPOSE 4000
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
|
||||
CMD curl -f http://localhost:4000/health || exit 1
|
||||
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
CMD ["node", "index.js"]
|
||||
|
||||
7
backend/docker-entrypoint.sh
Normal file
7
backend/docker-entrypoint.sh
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
mkdir -p /app/data /app/uploads
|
||||
chown -R node:node /app/data /app/uploads
|
||||
|
||||
exec su-exec node "$@"
|
||||
Reference in New Issue
Block a user