Skip to content
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

DockerImage Forked FF-4873 to master: Image ubuntu #1

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
42 changes: 28 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,34 @@
#Based upon John Vester's johnjvester/docker-salesforce image on hub.docker.com
FROM alpine
FROM mcr.microsoft.com/dotnet/core/sdk:2.2-bionic AS build
MAINTAINER Balinder Singh <[email protected]>
RUN apk update
RUN apk add bash
RUN apk add openjdk8
RUN apk add jq
RUN apk add --update nodejs npm
RUN apt-get update \
&& apt-get install -y bash openjdk-8-jdk jq ant nodejs npm
RUN echo "Node version:"
RUN node -v
RUN npm install -g npm
RUN npm -v
RUN npm install -g grunt-cli
RUN npm install -g sfdx-cli
RUN apk add apache-ant --update-cache \
--repository http://dl-cdn.alpinelinux.org/alpine/edge/community/ \
--allow-untrusted
RUN apk add --update curl && \
rm -rf /var/cache/apk/*
RUN echo "DOTNET version:"
RUN dotnet --version

ENTRYPOINT ["/usr/bin/curl"]
RUN apt-get install -y curl tar firefox unzip xvfb \
&& rm -rf /var/lib/apt/lists/*

RUN firefox --version
RUN \
# Create firefox + xvfb runner (it is in-memory display server to run firefox in headless mode)
mv /usr/bin/firefox /usr/bin/firefox-origin && \
echo $'#!/usr/bin/env sh\n\
Xvfb :0 -screen 0 1920x1080x24 -ac +extension GLX +render -noreset & \n\
DISPLAY=:0.0 firefox-origin $@ \n\
killall Xvfb' > /usr/bin/firefox && \
chmod +x /usr/bin/firefox

# geckodriver (it is the driver for firefox)
RUN curl https://github.com/mozilla/geckodriver/releases/download/v0.26.0/geckodriver-v0.26.0-linux64.tar.gz -O -L && ls && \
tar -zxvf geckodriver-v0.26.0-linux64.tar.gz && \
mv ./geckodriver /usr/local/bin/ && \
chmod a+x /usr/local/bin/geckodriver

ENV ANT_HOME /usr/share/java/apache-ant
ENV PATH $PATH:$ANT_HOME/bin
ENV PATH $PATH:$ANT_HOME/bin
41 changes: 40 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,40 @@
Salesforce deployment script for docker deployment
# Description
## An image which can be used in bitbucket pipeline or any other pipeline which supports linux based docker images. It is based off alpine with few run time and utility packages like .net core,ant,node/npm, grunt curl, Chrome and firefox web drivers for selenium web automation needs
# Components
* It gets alpine as base image (a lightweight distribution of linux) [alpine with dotnet core sdk 2.2](https://github.com/dotnet/dotnet-docker/blob/master/samples/dotnetapp/Dockerfile.alpine-x64)
* install bash (for scripting)
* jdk (to use ant library for salesforce deployment)
* jq (to parse json response in cli). [JSON processor](https://stedolan.github.io/jq/)
* nodejs/npm (node runtime and package manager) [node](https://nodejs.org)
* grunt-cli (cli for grunt task runner) [gruntjs](https://gruntjs.com/)
* checking dotnet version (our image is based off a dotnet core image from microsoft so it comes pre-installed)
* chromium and chromium-chromedriver and firefox and geckodriver (to use it in selenium web automation project) [selenium](https://www.seleniumhq.org/)
* apache-ant (to deploy metadata to salesforce) [ant](https://ant.apache.org/)
* curl (genral pupose sommnad line tool to transfer data eith URLS i.e. to make a POST using HTTP) [curl](https://curl.haxx.se/)
* and some other misc utility/supporting packages like xvfb, tar

## How you can test it locally if at-least the image builds without any errors:
> following steps are tested on Mac only
### Install docker on your machine if it is not installed.
### Once installed let's test if docker works fine on your machine. To check, open your terminal and run following command
```
docker --version
```
### and you should see its version, like this
*Docker version 18.09.2, build 6247962*
### After installing we need to start docker application before moving forward. You can do this by Docker GUI or by starting it from cli. Following command is tested in Mac only:
```
open --background -a Docker
```
It will take a while to docker to start and be ready to take further commands
### Now goto root of project folder and run following where ./Dockerfile is a path to the file which will be the definition of your image. *sfappdockv1* is the name of the image.
```
docker build . -t sfappdockv1 -f ./Dockerfile
```
> You might wanna make sure the Entrypoint in DockerFile is pointed to bash i.e. **ENTRYPOINT ["/bin/bash"]** to use bash so that you can interact with it using command line
```
docker run -it sfappdockv1
```
> -it allow you to run docker in interactive mode
### To detach the current Docker interactive mode without exiting the shell,
> use the escape sequence **Ctrl-p** + **Ctrl-q**