diff --git a/.gitignore b/.gitignore
index f710fdddc18f996fda303510b85613bfadcc5fa0..f3682eba70ade2d1b75e33984233e864795c8b08 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
 doc
 _build
+.rebar3
 rebar3
 rebar.lock
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index bebaf394eb6231ac391e745dcb43c061d53e3cdf..16fef4535122f66a52a998a1e489a47bae1d9860 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,5 +1,9 @@
+cache:
+  paths:
+    - .rebar3
+
 before_script:
-  - rebar3 update
+  - export PATH=${ERL_HOME}/bin:$PATH
 
 stages:
   - compile
@@ -9,6 +13,7 @@ stages:
 compile:
   stage: compile
   script:
+    - rebar3 update
     - rebar3 as production do compile
 
 test:
@@ -23,10 +28,9 @@ hex_publish:
     - /^\d+[.]\d+[.]\d+$/ # Only publish HEAD tagged with semantic version
   script:
     - mkdir -p ~/.hex && printf "{key,<<\"$HEX_KEY\">>}.\n{username,<<\"$HEX_USERNAME\">>}.\n" > ~/.hex/hex.config
-    - mkdir -p ~/.config/rebar3 && printf "{plugins, [rebar3_hex]}.\n" > ~/.config/rebar3/rebar.config
     - echo "Y" | rebar3 hex publish
 
-aws_publish:
+aws_s3:
   stage: publish
   only:
     - /^\d+[.]\d+[.]\d+$/ # Only publish HEAD tagged with semantic version
diff --git a/rebar.config b/rebar.config
index 7074cce8c716e3b54d59f668e8018342d4b133e5..e884fbec3ddd0f144d5349287a6a5611571a17a7 100644
--- a/rebar.config
+++ b/rebar.config
@@ -1,3 +1,7 @@
+{global_rebar_dir, ".rebar3"}.
+
+{plugins, [rebar3_hex]}.
+
 {relx, [
     {release, {gurka, semver}, [gurka]},
     {dev_mode, true},
@@ -23,4 +27,3 @@
         {erl_opts, [no_debug_info, warnings_as_errors]}
     ]}
 ]}.
-