Skip to content

armgit / dashy

Public Imported from GitHub
0

πŸš€ A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!

Attempt 1

Alicia Sykesc1092e12c012
diff --git a/Dockerfile b/Dockerfile
index e249559e..807d151b 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,26 +1,30 @@
-
-# Build Stage
+# build stage
FROM node:lts-alpine as build-stage
-LABEL Maintainer Alicia Sykes <[email protected]>
-
-RUN apk update
WORKDIR /app
-COPY package.json ./
-COPY yarn.lock ./
-RUN yarn install
+COPY package*.json ./
+RUN yarn install --frozen-lockfile
COPY . .
RUN yarn build
-# Production Stage
-ENV PORT 80
+# production stage
+FROM alpine:3.11
+
+ENV USER darkhttpd
+ENV GROUP darkhttpd
+ENV GID 911
+ENV UID 911
+ENV PORT 8080
-FROM nginx:1.15.7-alpine as production-stage
+RUN addgroup -S ${GROUP} -g ${GID} && adduser -D -S -u ${UID} ${USER} ${GROUP} && \
+ apk add -U --no-cache su-exec darkhttpd
-COPY --from=build-stage /app/dist /usr/share/nginx/html
+COPY --from=build-stage --chown=${USER}:${GROUP} /app/dist /www/
+COPY --from=build-stage --chown=${USER}:${GROUP} /app/dist/assets /www/default-assets
+COPY entrypoint.sh /entrypoint.sh
EXPOSE ${PORT}
-VOLUME /usr/share/nginx/html/item-icons
-CMD ["nginx", "-g", "daemon off;"]
+VOLUME /www/assets
+ENTRYPOINT ["/bin/sh", "/entrypoint.sh"]
\ No newline at end of file
diff --git a/entrypoint.sh b/entrypoint.sh
new file mode 100644
index 00000000..45e2caa4
--- /dev/null
+++ b/entrypoint.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Ensure default assets are present.
+while true; do echo n; done | cp -Ri /www/default-assets/* /www/assets/ &> /dev/null
+
+# Ensure compatibility with previous version (config.yml was in the root directory)
+if [ -f "/www/config.yml" ]; then
+ yes n | cp -i /www/config.yml /www/assets/ &> /dev/null
+fi
+
+# Install default config if no one is available.
+yes n | cp -i /www/default-assets/config.yml.dist /www/assets/config.yml &> /dev/null
+
+chown -R $UID:$GID /www/assets
+exec su-exec $UID:$GID darkhttpd /www/ --no-listing --port "$PORT"
\ No newline at end of file