grim/containers/trac-bootstrap
Clone
Summary
Browse
Changes
Graph
Fix some issues with the bootstrap
draft
default
tip
2021-05-02, Gary Kramlich
7a2164e313ac
Parents
0e1735501ef1
Children
Fix some issues with the bootstrap
3 files changed, 17 insertions(+), 3 deletions(-)
+7
-1
Dockerfile
+3
-0
README.md
+7
-2
bootstrap
--- a/Dockerfile Sun Apr 11 05:09:06 2021 -0500
+++ b/Dockerfile Sun May 02 05:48:05 2021 -0500
@@ -3,7 +3,13 @@
MAINTAINER Gary Kramlich <grim@reaperworld.com>
RUN set -ex && \
- apk add --no-cache mc bzip2 gzip tar xz zstd
+ apk add --no-cache wget bzip2 gzip tar xz zstd
+
+RUN set -ex && \
+ wget -O /usr/local/bin/mc https://dl.min.io/client/mc/release/linux-amd64/mc && \
+ chmod +x /usr/local/bin/mc
+
+COPY bootstrap /usr/local/bin/
ENTRYPOINT ["/usr/local/bin/bootstrap"]
--- a/README.md Sun Apr 11 05:09:06 2021 -0500
+++ b/README.md Sun May 02 05:48:05 2021 -0500
@@ -14,6 +14,9 @@
* `S3_KEY` The key in S3 that holds your trac backup.
* `S3_ACCESS_KEY` The S3 access key.
* `S3_SECRET_KEY` The S3 secret access key.
+ * `TAR_ARGS` Arguments to pass to tar. This will need to be set to the proper
+ argument for decompressing as the data is piped to tar so it can not guess
+ the filename.
* `UID` The user id to set on the extracted files.
These environment variables are used to create an alias in mc and then extract
--- a/bootstrap Sun Apr 11 05:09:06 2021 -0500
+++ b/bootstrap Sun May 02 05:48:05 2021 -0500
@@ -34,12 +34,17 @@
exit 0
fi
+# if the destination doesn't exist create it
+if [ ! -d "${DESTINATION}" ] ; then
+ mkdir -p "${DESTINATION}"
+fi
+
# create our alias in mc
mc alias set trac-bootstrap "${S3_URL}" "${S3_ACCESS_KEY}" "${S3_SECRET_KEY}"
-mc cat "trac-bootstrap/${S3_KEY}" | tar -xf -C "${DESTINATION}"
+mc cat "trac-bootstrap/${S3_KEY}" | tar -xv -C "${DESTINATION}" "${TAR_ARGS}"
-chmod -R "${UID}":"${GID}" "${DESTINATION}"
+chown -R "${UID}":"${GID}" "${DESTINATION}"
exit $?