Skip to content

Commit

Permalink
Update Dockerfile to consistently declare ARGs and simplify Node.js s…
Browse files Browse the repository at this point in the history
…etup
  • Loading branch information
akolotov committed Oct 1, 2024
1 parent 51d0cb8 commit 0e4862f
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
ARG VARIANT="1.17.3-erlang-27.1-debian-bullseye-20240926"
FROM hexpm/elixir:${VARIANT}

# ARGs declared before FROM are not persisted beyond the FROM instruction.
# They must be redeclared here to be available in the rest of the Dockerfile.
ARG PHOENIX_VERSION="1.7.10"
ARG NODE_VERSION="18"

Expand All @@ -14,11 +16,9 @@ ARG USER_GID=$USER_UID
ARG INSTALL_ZSH="true"
ARG UPGRADE_PACKAGES="true"
ARG COMMON_SCRIPT_SOURCE="https://raw.githubusercontent.com/microsoft/vscode-dev-containers/main/script-library/common-debian.sh"
ARG COMMON_SCRIPT_SHA="dev-mode"

# [Optional] Setup nodejs
# Options for setup nodejs
ARG NODE_SCRIPT_SOURCE="https://raw.githubusercontent.com/microsoft/vscode-dev-containers/main/script-library/node-debian.sh"
ARG NODE_SCRIPT_SHA="dev-mode"
ENV NVM_DIR=/usr/local/share/nvm
ENV NVM_SYMLINK_CURRENT=true
ENV PATH=${NVM_DIR}/current/bin:${PATH}
Expand All @@ -28,16 +28,12 @@ RUN apt-get update \
&& export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends curl ca-certificates 2>&1 \
&& curl -sSL ${COMMON_SCRIPT_SOURCE} -o /tmp/common-setup.sh \
&& ([ "${COMMON_SCRIPT_SHA}" = "dev-mode" ] || (echo "${COMMON_SCRIPT_SHA} */tmp/common-setup.sh" | sha256sum -c -)) \
&& /bin/bash /tmp/common-setup.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" \
#
# [Optional] Install Node.js for use with web applications
&& if [ "${NODE_VERSION}" != "none" ]; then \
curl -sSL ${NODE_SCRIPT_SOURCE} -o /tmp/node-setup.sh \
&& ([ "${NODE_SCRIPT_SHA}" = "dev-mode" ] || (echo "${NODE_SCRIPT_SHA} */tmp/node-setup.sh" | sha256sum -c -)) \
# Install Node.js for use with web applications
&& curl -sSL ${NODE_SCRIPT_SOURCE} -o /tmp/node-setup.sh \
&& /bin/bash /tmp/node-setup.sh "${NVM_DIR}" "${NODE_VERSION}" "${USERNAME}" \
&& npm install -g cspell@latest; \
fi \
&& npm install -g cspell@latest \
#
# Install dependencies
&& apt-get install -y build-essential inotify-tools \
Expand Down

0 comments on commit 0e4862f

Please sign in to comment.