Skip to content

Ubuntu-based image with Java, Node.js and Google Chrome #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea
*.iml
38 changes: 36 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,37 @@
FROM node:14.20-alpine3.15
# Hard-wire platform since our Node.js builds only ever need to be on amd64.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't do this - no reason not to do a multi arch build. I'm moving over TeamCity agents to be ARM where we can to save costs

FROM --platform=linux/amd64 ubuntu:22.04

RUN apk add --update openjdk17-jre patch
ARG NODE_VERSION=14.21.3
ARG JAVA_VERSION=17.0.12-1

# For available versions see https://www.ubuntuupdates.org/package/google_chrome/stable/main/base/google-chrome-stable
ARG CHROME_VERSION="132.0.6834.83-1"

SHELL [ "/bin/bash", "-o", "pipefail", "-c" ]

# Install basic tools
RUN apt-get update && apt-get clean && apt-get -qy upgrade
RUN apt-get -qy install --no-install-recommends gnupg ca-certificates curl bash vim nano jq wget

# Install Java for use by OpenAPI code generator
RUN curl -s https://repos.azul.com/azul-repo.key | gpg --dearmor -o /usr/share/keyrings/azul.gpg
RUN echo "deb [signed-by=/usr/share/keyrings/azul.gpg] https://repos.azul.com/zulu/deb stable main" > /etc/apt/sources.list.d/zulu.list
RUN apt-get update && \
apt-get -qy install --no-install-recommends zulu17-ca-jre-headless=${JAVA_VERSION} libjemalloc2 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Install NVM then use that to install the required version of Node.js
ENV NVM_DIR=/usr/local/nvm
RUN mkdir -p /usr/local/nvm
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
RUN source "$NVM_DIR/nvm.sh" && nvm install "v$NODE_VERSION" && nvm use $NODE_VERSION
ENV NODE_PATH="$NVM_DIR/versions/node/v$NODE_VERSION/bin"
ENV PATH=$NODE_PATH:$PATH

# Install Google Chrome for running unit tests in headless mode. It's important NOT to use Chromium which requires snap
# which can cause issues when running the Karma tests.
RUN apt-get update
RUN curl -LO https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}_amd64.deb
RUN apt install -y ./google-chrome-stable_${CHROME_VERSION}_amd64.deb
RUN rm google-chrome-stable_${CHROME_VERSION}_amd64.deb
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise here, the deb is already in the curl layer above

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Node build image

A basic node build image with java installed
A basic node build image with Node.js, Java and Google Chrome installed