Fix aws cli mount point when mounting a file
This commit is contained in:
parent
ea08597755
commit
1dde9c2962
@ -7,4 +7,4 @@ RUN apk --no-cache update && \
|
||||
pip --no-cache-dir install awscli && \
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
WORKDIR /mnt/uploads
|
||||
WORKDIR /mnt
|
||||
|
||||
@ -52,7 +52,7 @@ init() {
|
||||
cmd() {
|
||||
local localDir
|
||||
|
||||
__msg "Specify a mount point to /mnt/uploads inside the docker container"
|
||||
__msg "Specify a mount point to /mnt/host inside the docker container"
|
||||
|
||||
read localDir
|
||||
|
||||
@ -66,14 +66,14 @@ cmd() {
|
||||
fi
|
||||
fi
|
||||
|
||||
__warn "Mounting ${localDir} to /mnt/uploads inside the docker container"
|
||||
__warn "Mounting ${localDir} to /mnt/host inside the docker container"
|
||||
|
||||
docker run --rm \
|
||||
-u $(id -u) \
|
||||
--env AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \
|
||||
--env AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \
|
||||
--env AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION} \
|
||||
-v ${localDir}:/mnt/uploads \
|
||||
-v ${localDir}:/mnt/host \
|
||||
${CUSTOM_ARGS} \
|
||||
${SERVICE_NAME} \
|
||||
aws "$@"
|
||||
@ -100,9 +100,9 @@ upload() {
|
||||
--env AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \
|
||||
--env AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \
|
||||
--env AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION} \
|
||||
-v ${source}:/mnt/uploads \
|
||||
-v ${source}:/mnt/host \
|
||||
${SERVICE_NAME} \
|
||||
aws s3 cp /mnt/uploads s3://${target} ${args} --recursive --acl "${ACL}" --expires "${EXPIRES}" --cache-control "max-age=${CACHE_MAX_AGE}" --metadata-directive REPLACE
|
||||
aws s3 cp /mnt/host s3://${target} ${args} --recursive --acl "${ACL}" --expires "${EXPIRES}" --cache-control "max-age=${CACHE_MAX_AGE}" --metadata-directive REPLACE
|
||||
}
|
||||
|
||||
download() {
|
||||
@ -135,9 +135,9 @@ download() {
|
||||
--env AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \
|
||||
--env AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \
|
||||
--env AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION} \
|
||||
-v ${target}:/mnt/uploads \
|
||||
-v ${target}:/mnt/host \
|
||||
${SERVICE_NAME} \
|
||||
aws s3 cp s3://${source} /mnt/uploads ${args} --recursive --acl "${ACL}" --expires "${EXPIRES}" --cache-control "max-age=${CACHE_MAX_AGE}" --metadata-directive REPLACE
|
||||
aws s3 cp s3://${source} /mnt/host ${args} --recursive --acl "${ACL}" --expires "${EXPIRES}" --cache-control "max-age=${CACHE_MAX_AGE}" --metadata-directive REPLACE
|
||||
}
|
||||
|
||||
migrate() {
|
||||
@ -200,7 +200,7 @@ exec() {
|
||||
--env AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \
|
||||
--env AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \
|
||||
--env AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION} \
|
||||
-v ${source_dir}:/mnt/uploads \
|
||||
-v ${source_dir}:/mnt/host \
|
||||
${SERVICE_NAME} \
|
||||
sh
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user