inventaire: build image from a specific git ref
This commit is contained in:
@@ -13,13 +13,16 @@ USER 1000:1000
|
|||||||
|
|
||||||
WORKDIR /opt/inventaire
|
WORKDIR /opt/inventaire
|
||||||
|
|
||||||
|
ARG GIT_REF=main
|
||||||
|
ENV DOCKER=1
|
||||||
|
|
||||||
# - Create the client folder to prevent the server postinstall to run `npm run install-client` as it does it with the wrong workdir and env
|
# - Create the client folder to prevent the server postinstall to run `npm run install-client` as it does it with the wrong workdir and env
|
||||||
# - Create the public/sitemaps folder to prevent the client postinstall to run `npm run generate-sitemaps` (which needs to be updated to support non-inventaire.io instances)
|
# - Create the public/sitemaps folder to prevent the client postinstall to run `npm run generate-sitemaps` (which needs to be updated to support non-inventaire.io instances)
|
||||||
RUN git clone http://github.com/inventaire/inventaire --depth 1 . \
|
RUN git clone https://git.inventaire.io/inventaire --depth 1 --branch "${GIT_REF}" . \
|
||||||
&& mkdir -p /opt/inventaire/client \
|
&& mkdir -p /opt/inventaire/client \
|
||||||
&& npm ci --omit=dev \
|
&& npm ci --omit=dev \
|
||||||
&& npm run build \
|
&& npm run build \
|
||||||
&& git clone https://git.inventaire.io/inventaire-client.git ./client --branch docker --depth 1 \
|
&& git clone https://git.inventaire.io/inventaire-client ./client --branch docker --depth 1 --branch "${GIT_REF}" \
|
||||||
&& mkdir -p /opt/inventaire/client/public/sitemaps
|
&& mkdir -p /opt/inventaire/client/public/sitemaps
|
||||||
|
|
||||||
WORKDIR /opt/inventaire/client
|
WORKDIR /opt/inventaire/client
|
||||||
|
|||||||
@@ -6,10 +6,22 @@ cwd="$PWD"
|
|||||||
|
|
||||||
cd ./inventaire
|
cd ./inventaire
|
||||||
|
|
||||||
echo -n "Enter version number (ex: 3.0.0-beta): "
|
version=$(curl -s https://api.github.com/repos/inventaire/inventaire/tags | jq -r '.[].name' | head -n1 | sed 's/^v//')
|
||||||
read -r version
|
|
||||||
|
|
||||||
docker build -t inventaire -f ./Dockerfile.inventaire .
|
echo -e "Latest version number found: \e[0;32m${version}\e[0m"
|
||||||
|
|
||||||
|
response=0
|
||||||
|
while [ "$response" != "" ] && [ "$response" != "y" ] && [ "$response" != "n" ]; do {
|
||||||
|
echo -n "Confirm: Y/n? "
|
||||||
|
read -r response
|
||||||
|
}; done
|
||||||
|
|
||||||
|
if [ "$response" == "n" ]; then
|
||||||
|
echo -n "Enter version number (ex: 3.0.0-beta): "
|
||||||
|
read -r version
|
||||||
|
fi
|
||||||
|
|
||||||
|
docker build -t inventaire -f ./Dockerfile.inventaire --build-arg "GIT_REF=v${version}" .
|
||||||
|
|
||||||
docker tag inventaire "inventaire/inventaire:${version}"
|
docker tag inventaire "inventaire/inventaire:${version}"
|
||||||
docker tag inventaire inventaire/inventaire:latest
|
docker tag inventaire inventaire/inventaire:latest
|
||||||
|
|||||||
Reference in New Issue
Block a user