mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-30 03:23:48 +01:00
ac8565d820
Assuming docker engine is installed, it is now possible to run the dev server using 'docker-compose up --build' or run the production version using 'docker build -t bitburner . && docker run -it -p 8000:80 bitburner'.
36 lines
1.2 KiB
Docker
36 lines
1.2 KiB
Docker
FROM node:15.14.0 AS base
|
|
|
|
WORKDIR /app
|
|
|
|
# Scripts used in the npm preinstall hook
|
|
COPY scripts/engines-check.js scripts/semver.js scripts/
|
|
|
|
# Adding our dependencies and install before adding the rest of the files
|
|
# This prevents reinstallation of npm packages for every subsequent code modification
|
|
ENV npm_config_update_notifier=false
|
|
COPY package.json package-lock.json ./
|
|
RUN npm ci --loglevel=error --no-audit --no-fund && npm rebuild node-sass
|
|
|
|
# Adding all the remaining source files
|
|
COPY . .
|
|
|
|
# We need more than the default 512MB otherwise webpack will throw 'heap out of memory' exceptions
|
|
# https://nodejs.org/api/cli.html#cli_max_old_space_size_size_in_megabytes
|
|
ENV NODE_OPTIONS=--max-old-space-size=1536
|
|
|
|
FROM base AS dev
|
|
# This is the main development build using the file watcher if you mount volumes
|
|
USER node
|
|
EXPOSE 8000
|
|
CMD npm run start:container
|
|
|
|
FROM base AS prod-dist
|
|
# We'll simply build the production dist files here to later reuse in a simple webserver
|
|
RUN npm run build
|
|
|
|
FROM nginx:1.20.0-alpine AS prod
|
|
WORKDIR /usr/share/nginx/html
|
|
COPY --from=prod-dist /app/dist ./dist
|
|
COPY --from=prod-dist /app/index.html /app/favicon.ico /app/license.txt ./
|
|
EXPOSE 80
|