Browse Source

new: [mongo] switch to pre-built images with upgrade directory

Valentin Lab 4 weeks ago
parent
commit
5032e8b674
  1. 57
      mongo/README.org
  2. 19
      mongo/build/Dockerfile
  3. 1
      mongo/metadata.yml
  4. 4
      mongo/upgrade/build/4.0.24/Dockerfile
  5. 4
      mongo/upgrade/build/5.0.30/Dockerfile
  6. 4
      mongo/upgrade/build/6.0.19/Dockerfile
  7. 4
      mongo/upgrade/build/7.0.15/Dockerfile

57
mongo/README.org

@ -9,19 +9,58 @@ Since 4.0.6 based on alpine 3.9, alpine is not packaging mongo
anymore. So we use the official version (that is huge). We still
must change entrypoint to enforce proper directory paths.
A ``Dockerfile`` is provided for this mean.
*** Build new images
You can fetch latest official tags:
#+begin_quote
docker-tags-fetch mongo -l 10 -f '^[0-9]+\.[0-9]+\.[0-9]+$'
#+end_quote
Get the last upstream images versions with:
change it in docker file, then
#+begin_src sh
actions/upstream-versions -l 10
#+end_src
#+begin_quote
docker build . -t docker.0k.io/mongo:"$TAG"-myc
#+end_quote
Then use these function to help you manage the ~upgrade/build~
directory and create the ~*-myc~ images from upstream images:
#+begin_src sh
MONGO_VERSION=$(
docker-tags-fetch nextcloud -l 10 -f "^[0-9]+\.[0-9]+\.[0-9]+$" |
sort -V |
tail -n 1 |
cut -f 1 -d "-"
)
mk_build_dir() {
local new_version="$1" VLV VV T
(
cd upgrade/build
MONGO_LAST_VERSION=$(
find . -maxdepth 1 -mindepth 1 -type d -regex "./[0-9]+\.[0-9]+\.[0-9]+" -printf "%f\n" |
sort -V | tail -n 1)
for variant in ""; do
if [ -z "$variant" ]; then
VLV="${MONGO_LAST_VERSION}"
VV="${new_version}"
T="${new_version}-myc"
else
VLV="${MONGO_LAST_VERSION}-$variant"
VV="${new_version}-$variant"
T="${new_version}-myc-$variant"
fi
cp -r "${VLV}" "${VV}"
sed -ri "s/FROM mongo:.*/FROM mongo:${new_version}/g" "$VV"/Dockerfile
docker build "$VV" -t docker.0k.io/mongo:${T} || return 1
docker push "docker.0k.io/mongo:${T}" || return 1
done
)
}
mk_build_dir "$MONGO_VERSION"
#+end_src
** General Access

19
mongo/build/Dockerfile

@ -1,19 +0,0 @@
## Note: alpine version >= 3.9 is required to get mongodb version 4
## is a simple copy of alpine:3.9
FROM docker.0k.io/alpine:3.9 as common
## mongodb-tools is only required because we expect and use mongodump
## XXXvlab: bash is only required by mongo-backup, we could probably only use sh
RUN apk add --no-cache mongodb mongodb-tools bash
RUN mkdir -p /var/lib/mongod
RUN chown -R mongodb:mongodb /var/lib/mongod
VOLUME ["/var/lib/mongodb"]
EXPOSE 27017 28017
USER mongodb
ENTRYPOINT [ "mongod", "--config", "/etc/mongod.conf" ]

1
mongo/metadata.yml

@ -1,5 +1,6 @@
summary: "MongoDB server"
maintainer: "Valentin Lab <valentin.lab@kalysto.org>"
image: docker.0k.io/mongo:4.0.24-myc
data-resources:
- /var/lib/mongodb
config-resources:

4
mongo/upgrade/build/4.0.24/Dockerfile

@ -0,0 +1,4 @@
FROM mongo:4.0.24
ENTRYPOINT [ "mongod", "--config", "/etc/mongod.conf" ]

4
mongo/upgrade/build/5.0.30/Dockerfile

@ -0,0 +1,4 @@
FROM mongo:5.0.30
ENTRYPOINT [ "mongod", "--config", "/etc/mongod.conf" ]

4
mongo/upgrade/build/6.0.19/Dockerfile

@ -0,0 +1,4 @@
FROM mongo:6.0.19
ENTRYPOINT [ "mongod", "--config", "/etc/mongod.conf" ]

4
mongo/upgrade/build/7.0.15/Dockerfile

@ -0,0 +1,4 @@
FROM mongo:7.0.15
ENTRYPOINT [ "mongod", "--config", "/etc/mongod.conf" ]
Loading…
Cancel
Save