OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/docker/dev/frontend/Dockerfile

34 lines
833 B

FROM node:14.17
MAINTAINER operations@openproject.com
ARG DEV_UID=1000
ARG DEV_GID=1001
ENV USER=dev
RUN apt-get update && apt-get install -y chromium
RUN npm i -g npm
Speed up `bin/compose setup` significantly (#9404) With the proposed changes the time required to run `./bin/compose setup` is being reduced from ~18 minutes down to ~7 minutes on my machine. In addition a workaround is applied to reduce the size of the images. == Changes === Speed-Up `bundle install` The time spent withing `bundle install` takes a significant amount time during the `./bin/compose setup`. We could make use of two improvements, which both allows us to utitlize multiple CPU cures: * Make use of the bundle `--jobs` argument * Make use of the lesser known/used `MAKE` environment variable A significant amount of time spent during `bundle install` is actually compiling C-extensions, that's why the usage of the `MAKE` variable will drastically improve performence. === `useradd --no-log-init` Unfortunately there is a nasty bug when running `useradd` for a huge `uid`, which could result in excessive image sizes. See attached links for more information. === BuildKit BuildKit is the default builder toolkit for Docker on Windows and DockerDesktop on Macs. Using BuildKit will greatly improve performance when building docker images. == Links === Speed-Up `bundle install` * [One Weird Trick That Will Speed Up Your Bundle Install](https://build.betterup.com/one-weird-trick-that-will-speed-up-your-bundle-install/) === BuildKit * [Build images with BuildKit](https://docs.docker.com/develop/develop-images/build_enhancements/) * [Faster builds in Docker Compose 1.25.1 thanks to BuildKit Support](https://www.docker.com/blog/faster-builds-in-compose-thanks-to-buildkit-support/) === `useradd --no-log-init` * Best practices for writing Dockerfiles: [User](https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#user) * golang/co: [archive/tar: add support for writing tar containing sparse files](https://github.com/golang/go/issues/13548)
3 years ago
# `--no-log-init` is required as a workaround to avoid disk exhaustion.
#
# Read more at:
# * https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#user
# * https://github.com/golang/go/issues/13548
RUN useradd --no-log-init -d /home/$USER -m $USER -g node || true
Speed up `bin/compose setup` significantly (#9404) With the proposed changes the time required to run `./bin/compose setup` is being reduced from ~18 minutes down to ~7 minutes on my machine. In addition a workaround is applied to reduce the size of the images. == Changes === Speed-Up `bundle install` The time spent withing `bundle install` takes a significant amount time during the `./bin/compose setup`. We could make use of two improvements, which both allows us to utitlize multiple CPU cures: * Make use of the bundle `--jobs` argument * Make use of the lesser known/used `MAKE` environment variable A significant amount of time spent during `bundle install` is actually compiling C-extensions, that's why the usage of the `MAKE` variable will drastically improve performence. === `useradd --no-log-init` Unfortunately there is a nasty bug when running `useradd` for a huge `uid`, which could result in excessive image sizes. See attached links for more information. === BuildKit BuildKit is the default builder toolkit for Docker on Windows and DockerDesktop on Macs. Using BuildKit will greatly improve performance when building docker images. == Links === Speed-Up `bundle install` * [One Weird Trick That Will Speed Up Your Bundle Install](https://build.betterup.com/one-weird-trick-that-will-speed-up-your-bundle-install/) === BuildKit * [Build images with BuildKit](https://docs.docker.com/develop/develop-images/build_enhancements/) * [Faster builds in Docker Compose 1.25.1 thanks to BuildKit Support](https://www.docker.com/blog/faster-builds-in-compose-thanks-to-buildkit-support/) === `useradd --no-log-init` * Best practices for writing Dockerfiles: [User](https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#user) * golang/co: [archive/tar: add support for writing tar containing sparse files](https://github.com/golang/go/issues/13548)
3 years ago
RUN usermod -u $DEV_UID $USER || true
RUN groupadd $USER || true
RUN groupmod -g $DEV_GID $USER || true
EXPOSE 4200
RUN mkdir -p /home/$USER/openproject/public/assets/frontend
RUN chown $USER:$USER -R /home/$USER/openproject/public
VOLUME ["/home/$USER/openproject", "/home/$USER/openproject/public/assets/frontend"]
WORKDIR /home/$USER/openproject/frontend
USER $USER