Commit 17fbae5d authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

installing packages with cache in dockerfile

parent a51c92f2
...@@ -113,6 +113,7 @@ RUN chmod +x /entrypoint.sh ...@@ -113,6 +113,7 @@ RUN chmod +x /entrypoint.sh
COPY --chown=1000:1000 . /html COPY --chown=1000:1000 . /html
# Install packages # 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 USER 1000:1000
...@@ -57,32 +57,10 @@ spec: ...@@ -57,32 +57,10 @@ spec:
- name: env-files - name: env-files
secret: secret:
secretName: {{ .Values.application.secretName }} secretName: {{ .Values.application.secretName }}
- name: packages
persistentVolumeClaim:
claimName: packages
- name: node-modules
emptyDir: {}
- name: vendor
emptyDir: {}
securityContext: securityContext:
fsGroup: 1000 fsGroup: 1000
runAsUser: 1000 runAsUser: 1000
runAsGroup: 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: containers:
- name: {{ .Chart.Name }}-phpfpm - name: {{ .Chart.Name }}-phpfpm
image: {{ template "imagename" . }} image: {{ template "imagename" . }}
...@@ -102,10 +80,6 @@ spec: ...@@ -102,10 +80,6 @@ spec:
mountPath: /html/.env mountPath: /html/.env
subPath: ENV_FILE subPath: ENV_FILE
readOnly: true readOnly: true
- name: vendor
mountPath: /html/vendor
- name: node-modules
mountPath: /html/node_modules
{{- if .Values.lifecycle }} {{- if .Values.lifecycle }}
lifecycle: lifecycle:
{{ toYaml .Values.lifecycle | indent 10 }} {{ toYaml .Values.lifecycle | indent 10 }}
...@@ -180,10 +154,6 @@ spec: ...@@ -180,10 +154,6 @@ spec:
mountPath: /html/.env mountPath: /html/.env
subPath: ENV_FILE subPath: ENV_FILE
readOnly: true readOnly: true
- name: vendor
mountPath: /html/vendor
- name: node-modules
mountPath: /html/node_modules
livenessProbe: livenessProbe:
exec: exec:
command: command:
......
...@@ -2,15 +2,10 @@ ...@@ -2,15 +2,10 @@
set -e set -e
# Extract cache mc alias set --path=on --api S3v4 packages $S3_HOST $AWS_ACCESS_KEY_ID $AWS_SECRET_ACCESS_KEY
if [ -f /cache/npm.tar ]; if mc cp packages/$S3_BUCKETNAME/packages.tar /tmp/;
then then
tar -xf /cache/npm.tar tar -xf /tmp/packages.tar
fi
if [ -f /cache/composer.tar ];
then
tar -xf /cache/composer.tar
fi fi
# Install node modules # Install node modules
...@@ -21,6 +16,6 @@ npm run prod ...@@ -21,6 +16,6 @@ npm run prod
export COMPOSER_HOME=/cache/.composer export COMPOSER_HOME=/cache/.composer
composer install --no-dev composer install --no-dev
# Package Cache # Add the new cache to the bucket
tar -cf /cache/npm.tar .npm tar -cf /tmp/packages.tar .npm .composer
tar -cf /cache/composer.tar .composer mc cp /tmp/packages.tar packages/$S3_BUCKETNAME/
\ No newline at end of file \ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment