Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
Proxy
Commits
17fbae5d
Commit
17fbae5d
authored
Aug 17, 2021
by
Dominik Hebeler
Browse files
installing packages with cache in dockerfile
parent
a51c92f2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Dockerfile
View file @
17fbae5d
...
...
@@ -113,6 +113,7 @@ RUN chmod +x /entrypoint.sh
COPY
--chown=1000:1000 . /html
# Install packages
#RUN mc alias set --path=on --api S3v4 packages $S3_HOST $AWS_ACCESS_KEY_ID $AWS_SECRET_ACCESS_KEY && \
RUN
chmod
+x ./helpers/installPackages.sh
&&
\
/bin/sh
-c
./helpers/installPackages.sh
USER
1000:1000
chart/templates/deployment.yaml
View file @
17fbae5d
...
...
@@ -57,32 +57,10 @@ spec:
-
name
:
env-files
secret
:
secretName
:
{{
.Values.application.secretName
}}
-
name
:
packages
persistentVolumeClaim
:
claimName
:
packages
-
name
:
node-modules
emptyDir
:
{}
-
name
:
vendor
emptyDir
:
{}
securityContext
:
fsGroup
:
1000
runAsUser
:
1000
runAsGroup
:
1000
initContainers
:
-
name
:
{{
.Chart.Name
}}
-install-resources
image
:
{{
template "imagename" .
}}
imagePullPolicy
:
{{
.Values.image.pullPolicy
}}
volumeMounts
:
-
name
:
vendor
mountPath
:
/html/vendor
-
name
:
node-modules
mountPath
:
/html/node_modules
-
name
:
packages
mountPath
:
/cache
# Run init container as root to allow setting proper file permissions
securityContext
:
runAsUser
:
0
command
:
[
"
/bin/sh"
,
"
-c"
,
"
chmod
+x
/html/helpers/initProduction.sh
&&
/html/helpers/initProduction.sh"
]
containers
:
-
name
:
{{
.Chart.Name
}}
-phpfpm
image
:
{{
template "imagename" .
}}
...
...
@@ -102,10 +80,6 @@ spec:
mountPath
:
/html/.env
subPath
:
ENV_FILE
readOnly
:
true
-
name
:
vendor
mountPath
:
/html/vendor
-
name
:
node-modules
mountPath
:
/html/node_modules
{{
- if .Values.lifecycle
}}
lifecycle
:
{{
toYaml .Values.lifecycle | indent 10
}}
...
...
@@ -180,10 +154,6 @@ spec:
mountPath
:
/html/.env
subPath
:
ENV_FILE
readOnly
:
true
-
name
:
vendor
mountPath
:
/html/vendor
-
name
:
node-modules
mountPath
:
/html/node_modules
livenessProbe
:
exec
:
command
:
...
...
helpers/in
itProduction
.sh
→
helpers/in
stallPackages
.sh
View file @
17fbae5d
...
...
@@ -2,15 +2,10 @@
set
-e
# Extract cache
if
[
-f
/cache/npm.tar
]
;
then
tar
-xf
/cache/npm.tar
fi
if
[
-f
/cache/composer.tar
]
;
then
tar
-xf
/cache/composer.tar
mc
alias set
--path
=
on
--api
S3v4 packages
$S3_HOST
$AWS_ACCESS_KEY_ID
$AWS_SECRET_ACCESS_KEY
if
mc
cp
packages/
$S3_BUCKETNAME
/packages.tar /tmp/
;
then
tar
-xf
/tmp/packages.tar
fi
# Install node modules
...
...
@@ -21,6 +16,6 @@ npm run prod
export
COMPOSER_HOME
=
/cache/.composer
composer
install
--no-dev
# Package Cache
tar
-cf
/cache/npm.tar .npm
tar
-cf
/cache/composer.tar .composer
\ No newline at end of file
# Add the new cache to the bucket
tar
-cf
/tmp/packages.tar .npm .composer
mc
cp
/tmp/packages.tar packages/
$S3_BUCKETNAME
/
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment