Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
76 lines (64 loc) · 2.62 KB
/
Copy pathDockerfile
File metadata and controls
76 lines (64 loc) · 2.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Storefront Reference Architecture deployment Dockerfile
# Source of image
FROM node:12
LABEL maintainer="Oleg Sapishchuk"
LABEL license="MIT"
# Install packages and update
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y rsync zip
# Build variables
ARG GITHUBLOGIN
ARG GITHUBTOKEN
ARG SANDBOXNAME
ARG SFCCLOGIN
ARG SFCCPWD
ARG SFCCCODEVERSION="code"
ARG SFCCAPIKEY
ARG SFCCAPISECRET
ARG USNO="us01"
#Build Salesforce Commerce Cloud working folder
RUN mkdir home/sfcc
WORKDIR /home/sfcc
# Pull & Build SFRA code
# Prepare dw.json for Prophet plugin
# Package code in the zip bundle
RUN git clone https://"${GITHUBLOGIN}":"${GITHUBTOKEN}"@github.com/SalesforceCommerceCloud/storefront-reference-architecture \
&& cd storefront-reference-architecture \
&& npm install \
&& npm run compile:js \
&& npm run compile:scss \
&& npm run compile:fonts \
&& echo "{" \
"\"hostname\":\"${SANDBOXNAME}.sandbox.${USNO}.dx.commercecloud.salesforce.com\"," \
"\"username\":\"${SFCCLOGIN}\"," \
"\"password\":\"${SFCCPWD}\"," \
"\"code-version\":\"${SFCCCODEVERSION}\"" \
"}" > dw.json \
&& mkdir -p tmp/code \
&& cp -R cartridges/* tmp/code \
&& cd tmp \
&& zip -r -q code.zip code \
&& rm -r code
# Pull and Zip SFRA data
RUN git clone https://"${GITHUBLOGIN}":"${GITHUBTOKEN}"@github.com/SalesforceCommerceCloud/storefrontdata \
&& cd storefrontdata && npm run zipData
# Pull and Install SFCC CLI
RUN git clone https://"${GITHUBLOGIN}":"${GITHUBTOKEN}"@github.com/SalesforceCommerceCloud/sfcc-ci \
&& cd sfcc-ci && npm install -g
# Deploy code to instance
RUN sfcc-ci client:auth "${SFCCAPIKEY}" "${SFCCAPISECRET}" \
&& cd storefront-reference-architecture \
&& sfcc-ci code:deploy tmp/code.zip -i "${SANDBOXNAME}.sandbox.us02.dx.commercecloud.salesforce.com" \
&& sfcc-ci code:activate code -i "${SANDBOXNAME}.sandbox.us02.dx.commercecloud.salesforce.com"
# Deploy data to instance
RUN sfcc-ci client:auth "${SFCCAPIKEY}" "${SFCCAPISECRET}" \
&& cd storefrontdata \
&& sfcc-ci instance:upload demo_data_sfra.zip -i "${SANDBOXNAME}.sandbox.us02.dx.commercecloud.salesforce.com" \
&& sfcc-ci instance:import demo_data_sfra.zip -i "${SANDBOXNAME}.sandbox.us02.dx.commercecloud.salesforce.com" -s
# Reindex site and rebuild urls
RUN sfcc-ci client:auth "${SFCCAPIKEY}" "${SFCCAPISECRET}" \
&& sfcc-ci job:run Reindex --instance "${SANDBOXNAME}.sandbox.us02.dx.commercecloud.salesforce.com" --sync --json \
&& sfcc-ci job:run RebuildURLs --instance "${SANDBOXNAME}.sandbox.us02.dx.commercecloud.salesforce.com" --sync --json
# this command will confirm node was installed correctly, and fail out if the command fails
CMD [ "node" ]