stack-orchestrator/stack_orchestrator/data/container-build/cerc-webapp-base/Dockerfile
Thomas E Lackey cc541ac20f
Some checks failed
Lint Checks / Run linter (push) Successful in 44s
Publish / Build and publish (push) Successful in 1m12s
Smoke Test / Run basic test suite (push) Successful in 2m48s
Webapp Test / Run webapp test suite (push) Successful in 5m40s
Deploy Test / Run deploy test suite (push) Successful in 6m23s
Fixturenet-Laconicd-Test / Run an Laconicd fixturenet test (push) Successful in 9m42s
Fixturenet-Eth-Plugeth-Arm-Test / Run an Ethereum plugeth fixturenet test (push) Failing after 4s
Fixturenet-Eth-Plugeth-Test / Run an Ethereum plugeth fixturenet test (push) Successful in 35m37s
K8s Deploy Test / Run deploy test suite on kind/k8s (push) Successful in 5m21s
Database Test / Run database hosting test on kind/k8s (push) Successful in 7m12s
Container Registry Test / Run contaier registry hosting test on kind/k8s (push) Successful in 2m50s
Use -slim variant for Dockerfile (#773)
This saves about 1GB of space in the image.

Reviewed-on: #773
Co-authored-by: Thomas E Lackey <telackey@bozemanpass.com>
Co-committed-by: Thomas E Lackey <telackey@bozemanpass.com>
2024-02-28 04:37:57 +00:00

59 lines
2.3 KiB
Docker

# Originally from: https://github.com/devcontainers/images/blob/main/src/javascript-node/.devcontainer/Dockerfile
# [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 18, 16, 14, 18-bullseye, 16-bullseye, 14-bullseye, 18-buster, 16-buster, 14-buster
ARG VARIANT=20-bullseye-slim
FROM node:${VARIANT}
ARG USERNAME=node
ARG NPM_GLOBAL=/usr/local/share/npm-global
# Add NPM global to PATH.
ENV PATH=${NPM_GLOBAL}/bin:${PATH}
# Prevents npm from printing version warnings
ENV NPM_CONFIG_UPDATE_NOTIFIER=false
RUN \
# Configure global npm install location, use group to adapt to UID/GID changes
if ! cat /etc/group | grep -e "^npm:" > /dev/null 2>&1; then groupadd -r npm; fi \
&& usermod -a -G npm ${USERNAME} \
&& umask 0002 \
&& mkdir -p ${NPM_GLOBAL} \
&& touch /usr/local/etc/npmrc \
&& chown ${USERNAME}:npm ${NPM_GLOBAL} /usr/local/etc/npmrc \
&& chmod g+s ${NPM_GLOBAL} \
&& npm config -g set prefix ${NPM_GLOBAL} \
&& su ${USERNAME} -c "npm config -g set prefix ${NPM_GLOBAL}" \
# Install eslint
&& su ${USERNAME} -c "umask 0002 && npm install -g eslint" \
# Install semver
&& su ${USERNAME} -c "umask 0002 && npm install -g semver" \
# Install pnpm
&& su ${USERNAME} -c "umask 0002 && npm install -g pnpm" \
&& npm cache clean --force > /dev/null 2>&1
# [Optional] Uncomment this section to install additional OS packages.
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends jq gettext-base
# [Optional] Uncomment if you want to install an additional version of node using nvm
# ARG EXTRA_NODE_VERSION=10
# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}"
# We do this to get a yq binary from the published container, for the correct architecture we're building here
COPY --from=docker.io/mikefarah/yq:latest /usr/bin/yq /usr/local/bin/yq
COPY scripts /scripts
# [Optional] Uncomment if you want to install more global node modules
# RUN su node -c "npm install -g <your-package-list-here>"
RUN mkdir -p /config
# Install simple web server for now (use nginx perhaps later)
RUN yarn global add http-server
# Expose port for http
EXPOSE 80
# Default command sleeps forever so docker doesn't kill it
CMD ["/scripts/start-serving-app.sh"]