Skip to content

Commit

Permalink
Add Docker Image (#572)
Browse files Browse the repository at this point in the history
* Update readme instructions --skip-ci

* Code Delivery 1.16.1

* Disable Extensive Logging & Repetitions on Git Based Deploy (#523)
* Fixes local compilation #525 (#532)

* Improve the documentation for lwcCompiler (#528)

lwcCompilerVersion and lwcCompilerNamespace documentation should be clearer. Currently the example is using the release version such as 236 or 238, but it needs to be the package version such as 900.469. Also examples of namespaces would be good.

* Reverting to node10 to publish 1.16.4

* Update to node14

* Update Dockerfile

* Update Dockerfile

* Update Dockerfile

* New Minor Version

* add docker image that customers/developers can use in their ci automations or to setup development environments based on containers

* remove dependabot

---------

Co-authored-by: Adam Rutland <arutland@salesforce.com>
Co-authored-by: Manas Agarwal <manas.agarwal@salesforce.com>
Co-authored-by: Dean Hobden <dean.hobden@centrica.com>
  • Loading branch information
4 people authored Mar 21, 2023
1 parent fddf478 commit 2bf940f
Show file tree
Hide file tree
Showing 5 changed files with 154 additions and 0 deletions.
82 changes: 82 additions & 0 deletions devops/containers/sfdx-vlocity/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# base image
FROM node:14

# copy folders
COPY node-packages/ node-packages/
COPY sfdx-plugins/ sfdx-plugins/

## pre install env variables
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
ENV SFDX_HIDE_RELEASE_NOTES=true

# install packages from http://deb.debian.org
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
gnupg \
apt-utils \
apt-transport-https \
curl \
wget \
openssh-client \
ca-certificates \
jq \
bc \
gettext \
xmlstarlet \
bash \
python3 \
libxml2 \
libxml2-utils \
wget \
openjdk-11-jre \
&& wget --quiet --output-document=- https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor > /etc/apt/trusted.gpg.d/google-archive.gpg \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
google-chrome-stable \
fonts-ipafont-gothic \
fonts-wqy-zenhei \
fonts-thai-tlwg \
fonts-kacst \
fonts-freefont-ttf \
libxss1 \
gh \
&& rm -rf /var/lib/apt/lists/*

# install packages from https://registry.npmjs.org
WORKDIR /node-packages
RUN cat ./package.json | jq '.devDependencies | keys[] as $k | "\($k)@\(.[$k])"' | xargs -t npm install --global

# install sfdx plugins from https://registry.npmjs.org
WORKDIR /sfdx-plugins
RUN chmod +x sfdx-plugins-installer.sh && ./sfdx-plugins-installer.sh

## post install env variables
ENV JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"
ENV PATH="$PATH:$JAVA_HOME/bin"
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/google-chrome
ENV SFDX_AUTOUPDATE_DISABLE=false
ENV SFDX_JSON_TO_STDOUT=true
ENV SFDX_USE_GENERIC_UNIX_KEYCHAIN=true
ENV SFDX_DOMAIN_RETRY=true
ENV SFDX_PROJECT_AUTOUPDATE_DISABLE_FOR_PACKAGE_CREATE=true
ENV SFDX_PROJECT_AUTOUPDATE_DISABLE_FOR_PACKAGE_VERSION_CREATE=true
ENV SFDX_DISABLE_DNS_CHECK=true
ENV SHELL=/bin/bash

# tests
RUN java --version \
&& tsc -v \
&& sfdx --version \
&& sf --version \
&& sfdx plugins --core \
&& vlocity -v \
&& sfdx sgd -h \
&& gh --version

# clean
RUN rm -f ~/.npmrc \
&& rm -rf /node-packages \
&& rm -rf /sfdx-plugins
43 changes: 43 additions & 0 deletions devops/containers/sfdx-vlocity/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# sfdx-vlocity

This docker image bundles all the dependencies needed for developing Vlocity Applications for Salesforce.

Developers can use this image to:

- run CI automations.
- create cloud or local development environments using docker containers.

## Dependencies

- Openjdk 11
- Node 14
- sfdx cli
- vlocity cli

### SFDX plugins

- sfdx-git-delta

## How to build

```shell
docker build --platform linux/amd64 --no-cache --progress plain .
```

## Tools to setup Development Environments using Containers

### Local

- [Docker Desktop](https://www.docker.com/products/docker-desktop/).

or Visual Studio Code|Github [`devcontainer.json`](https://containers.dev/implementors/json_reference/) files.

- [devcontainers cli](https://github.com/devcontainers/cli).

- Visual Studio Code extension called [Dev Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers).

### Cloud

- [Codespaces](https://github.com/features/codespaces)

- [Gitpod](https://www.gitpod.io/)
12 changes: 12 additions & 0 deletions devops/containers/sfdx-vlocity/node-packages/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "global-dependencies",
"version": "1.0.0",
"description": "This package controls global npm dependencies",
"devDependencies": {
"typescript": "4.9.5",
"@salesforce/cli": "1.67.1",
"sfdx-cli": "7.188.1",
"vlocity": "1.17.0",
"puppeteer": "19.7.2"
}
}
8 changes: 8 additions & 0 deletions devops/containers/sfdx-vlocity/sfdx-plugins/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "sfdx-plugins",
"version": "1.0.0",
"description": "This package controls sfdx plugins",
"devDependencies": {
"sfdx-git-delta": "5.13.3"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

for row in $(cat package.json | jq -c '.devDependencies | to_entries | .[]'); do
name=$(echo $row | jq -r '.key')
# sfdx plugins:install does not work with ~ and ^ https://github.com/forcedotcom/cli/issues/1966
version=$(echo $row | jq -r '.value' | cut -d "~" -f2 | cut -d "^" -f2)
echo "Installing $name@$version"
echo 'y' | sfdx plugins:install $name@$version
done

0 comments on commit 2bf940f

Please sign in to comment.