Files
Homarr/Dockerfile
Thomas Camlong 811d940f2b 🐳 Fix issues with dockerfile (#1611)
* Add `wait $PID` to be able to send SIG_ABORT

* Move to docker `entrypoint`

* Change default NEXTAUTH_URL

* Add `VOLUME` instruction

* corrected a typo

* 🐳 Fix docker TCP not working

Fixes Lost docker connection via TCP with 0.14.0 update #1577

* 🚧 Improve dockerfile and start script and fix permission issue by adding new user with permission to read / write to /data folder

* 🐛 Cleanup changes, Local db:migrate script not working, CI failed

*  Image properties customization (#1590)

* 🌐 New Crowdin updates (#1572)

*  Add notice page for readonly db

* Misc docker changes

* 🐳 Add `homarr` as `USER`

* 🐛 Unable to use user homarr because db.sqlite file is already owned by root

---------

Co-authored-by: Lumilias <10852161+Lumilias@users.noreply.github.com>
Co-authored-by: Meier Lukas <meierschlumpf@gmail.com>
Co-authored-by: Manuel <30572287+manuel-rw@users.noreply.github.com>
Co-authored-by: Manuel <manuel.ruwe@bluewin.ch>
2023-11-13 20:04:44 +01:00

61 lines
1.7 KiB
Docker

FROM node:20.5-slim
WORKDIR /app
# Define node.js environment variables
ARG PORT=7575
ENV NEXT_TELEMETRY_DISABLED 1
ENV NODE_ENV production
ENV NODE_OPTIONS '--no-experimental-fetch'
COPY next.config.js ./
COPY public ./public
COPY package.json ./temp_package.json
COPY yarn.lock ./temp_yarn.lock
# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY .next/standalone ./
COPY .next/static ./.next/static
COPY ./scripts/run.sh ./scripts/run.sh
COPY ./drizzle ./drizzle
COPY ./drizzle/migrate ./migrate
COPY ./tsconfig.json ./migrate/tsconfig.json
RUN mkdir /data
# Install dependencies
RUN apt update && apt install -y openssl wget
# Move node_modules to temp location to avoid overwriting
RUN mv node_modules _node_modules
RUN rm package.json
# Install dependencies for migration
RUN cp ./migrate/package.json ./package.json
RUN yarn
# Copy better_sqlite3 build for current platform
RUN cp /app/node_modules/better-sqlite3/build/Release/better_sqlite3.node /app/_node_modules/better-sqlite3/build/Release/better_sqlite3.node
# Copy node_modules for migration to migrate folder for migration script
RUN mv node_modules ./migrate/node_modules
# Copy temp node_modules of app to app folder
RUN mv _node_modules node_modules
# Expose the default application port
EXPOSE $PORT
ENV PORT=${PORT}
ENV DATABASE_URL "file:/data/db.sqlite"
ENV NEXTAUTH_URL "http://localhost:7575"
ENV PORT 7575
ENV NEXTAUTH_SECRET NOT_IN_USE_BECAUSE_JWTS_ARE_UNUSED
HEALTHCHECK --interval=10s --timeout=5s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:${PORT} || exit 1
VOLUME [ "/app/data/configs" ]
VOLUME [ "/data" ]
ENTRYPOINT ["sh", "./scripts/run.sh"]