-
Notifications
You must be signed in to change notification settings - Fork 428
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
27 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,39 @@ | ||
FROM node:18-alpine | ||
FROM --platform=$BUILDPLATFORM node:18-alpine AS build | ||
ARG BUILDPLATFORM | ||
|
||
# install build dependencies | ||
RUN apk add --no-cache libc6-compat git python3 py3-pip make g++ libusb-dev eudev-dev linux-headers | ||
WORKDIR /app | ||
COPY . . | ||
|
||
# Fix arm64 timeouts | ||
RUN yarn config set network-timeout 300000 && yarn global add node-gyp | ||
|
||
# install deps | ||
# install NPM dependencies | ||
RUN yarn install --frozen-lockfile | ||
RUN yarn after-install | ||
|
||
ENV NODE_ENV production | ||
ENV NODE_ENV=production | ||
|
||
# disable Next.js telemetry | ||
ENV NEXT_TELEMETRY_DISABLED=1 | ||
|
||
RUN yarn build | ||
|
||
FROM alpine | ||
|
||
RUN apk add busybox-extras tini | ||
WORKDIR /www | ||
COPY --from=build /app/out /www | ||
|
||
# Next.js collects completely anonymous telemetry data about general usage. | ||
# Learn more here: https://nextjs.org/telemetry | ||
# Uncomment the following line in case you want to disable telemetry during the build. | ||
ENV NEXT_TELEMETRY_DISABLED 1 | ||
# Next.js automatically adds `.html` extensions to URLs, but static HTTP file | ||
# servers don't generally do this. You can work around this by creating symbolic | ||
# links from `my-page.html` to either `my-page/index.html` or `my-page` | ||
# depending on whether or not a `my-page` directory exists. | ||
RUN find /www -name '*.html' -exec sh -c 'f="{}"; b="${f%.*}"; [ -d "$b" ] && ln -s "$f" "$b/index.html" || ln -s "$f" "$b"' ';' | ||
|
||
EXPOSE 3000 | ||
|
||
ENV PORT 3000 | ||
ENV PORT=3000 | ||
RUN echo '#!/bin/sh' > /usr/local/bin/docker-entrypoint.sh &&\ | ||
echo 'busybox-extras httpd -fvv -h /www -p 0.0.0.0:${PORT:-3000}' >> /usr/local/bin/docker-entrypoint.sh &&\ | ||
chmod +x /usr/local/bin/docker-entrypoint.sh | ||
|
||
CMD ["yarn", "static-serve"] | ||
CMD ["tini", "--", "docker-entrypoint.sh"] |