From 2d7b780e56682a2296f1015d6263c91c1d28b991 Mon Sep 17 00:00:00 2001
From: salvo-github <36646452+salvo-github@users.noreply.github.com>
Date: Fri, 1 Mar 2019 04:04:03 +0100
Subject: [PATCH] Auth file for magento 2 installation (#2022)
---
DOCUMENTATION/content/documentation/index.md | 17 +++++++++++++++++
docker-compose.yml | 1 +
env-example | 1 +
workspace/Dockerfile | 12 ++++++++++++
workspace/auth.json | 8 ++++++++
5 files changed, 39 insertions(+)
create mode 100644 workspace/auth.json
diff --git a/DOCUMENTATION/content/documentation/index.md b/DOCUMENTATION/content/documentation/index.md
index 5a5f2b3d..1fa6ff62 100644
--- a/DOCUMENTATION/content/documentation/index.md
+++ b/DOCUMENTATION/content/documentation/index.md
@@ -1543,6 +1543,23 @@ Enabling Global Composer Install during the build for the container allows you t
+
+
+## Magento 2 authentication credential (composer install)
+
+1 - Open the `.env` file
+
+2 - Search for the `WORKSPACE_COMPOSER_AUTH` argument under the Workspace Container and set it to `true`
+
+3 - Now add your credentials to `workspace/auth.json`
+
+4 - Re-build the Workspace Container `docker-compose build workspace`
+
+
+
+
+
+
## Install Prestissimo
diff --git a/docker-compose.yml b/docker-compose.yml
index 005a95b0..e7aff2ac 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -78,6 +78,7 @@ services:
- INSTALL_AEROSPIKE=${WORKSPACE_INSTALL_AEROSPIKE}
- INSTALL_V8JS=${WORKSPACE_INSTALL_V8JS}
- COMPOSER_GLOBAL_INSTALL=${WORKSPACE_COMPOSER_GLOBAL_INSTALL}
+ - COMPOSER_AUTH=${WORKSPACE_COMPOSER_AUTH}
- COMPOSER_REPO_PACKAGIST=${WORKSPACE_COMPOSER_REPO_PACKAGIST}
- INSTALL_WORKSPACE_SSH=${WORKSPACE_INSTALL_WORKSPACE_SSH}
- INSTALL_LARAVEL_ENVOY=${WORKSPACE_INSTALL_LARAVEL_ENVOY}
diff --git a/env-example b/env-example
index 70b35708..e944f1a0 100644
--- a/env-example
+++ b/env-example
@@ -82,6 +82,7 @@ DOCKER_SYNC_STRATEGY=native_osx
### WORKSPACE #############################################
WORKSPACE_COMPOSER_GLOBAL_INSTALL=true
+WORKSPACE_COMPOSER_AUTH=false
WORKSPACE_COMPOSER_REPO_PACKAGIST=
WORKSPACE_INSTALL_NODE=true
WORKSPACE_NODE_VERSION=node
diff --git a/workspace/Dockerfile b/workspace/Dockerfile
index 5cb86194..501c4873 100644
--- a/workspace/Dockerfile
+++ b/workspace/Dockerfile
@@ -118,6 +118,9 @@ USER root
# Add the composer.json
COPY ./composer.json /home/laradock/.composer/composer.json
+# Add the auth.json for magento 2 credentials
+COPY ./auth.json /home/laradock/.composer/auth.json
+
# Make sure that ~/.composer belongs to laradock
RUN chown -R laradock:laradock /home/laradock/.composer
@@ -132,6 +135,15 @@ RUN if [ ${COMPOSER_GLOBAL_INSTALL} = true ]; then \
composer global install \
;fi
+# Check if auth file is disabled
+ARG COMPOSER_AUTH=false
+ENV COMPOSER_AUTH ${COMPOSER_AUTH}
+
+RUN if [ ${COMPOSER_AUTH} = false ]; then \
+ # remove the file
+ rm /home/laradock/.composer/auth.json
+;fi
+
ARG COMPOSER_REPO_PACKAGIST
ENV COMPOSER_REPO_PACKAGIST ${COMPOSER_REPO_PACKAGIST}
diff --git a/workspace/auth.json b/workspace/auth.json
new file mode 100644
index 00000000..03cde45f
--- /dev/null
+++ b/workspace/auth.json
@@ -0,0 +1,8 @@
+{
+ "http-basic": {
+ "repo.magento.com": {
+ "username": "",
+ "password": ""
+ }
+ }
+}