mirror of
https://github.com/hnhx/librex.git
synced 2025-04-29 14:09:27 -04:00
chore: for the initial execution, the entrypoint should include the addition of buildx
This commit is contained in:
parent
450560eb6d
commit
b3a6a43acb
2 changed files with 24 additions and 6 deletions
|
@ -1,2 +1,21 @@
|
|||
#!/bin/sh
|
||||
|
||||
# The block below will use iteration to either build the necessary Docker image or simply run the required containers using the provided entrypoint arguments
|
||||
# First, the image will be created, and then the container will be run using the image that was generated
|
||||
for image in "$@"
|
||||
do
|
||||
# The following command will display the IDs of Docker images filtered by name
|
||||
# See more: https://docs.docker.com/engine/reference/commandline/images/
|
||||
if [ ! "$(docker images -aq --filter 'reference=${image}')" ]; then
|
||||
docker buildx build -f scripts/${image}.dockerfile -t ${image}:latest scripts/
|
||||
fi
|
||||
|
||||
# The following command will achieve the same result as the previous command, but for containers rather than images
|
||||
# See more: https://docs.docker.com/engine/reference/commandline/ps/
|
||||
if [ ! "$(docker ps -aq --filter name=${image})" ]; then
|
||||
[ "$(docker ps -aq --filter status=exited -f name=${image})" ] && docker rm ${image}
|
||||
docker run -d --name ${image} ${image}:latest
|
||||
fi
|
||||
done
|
||||
|
||||
exec sleep infinity
|
||||
|
|
11
Dockerfile
11
Dockerfile
|
@ -1,6 +1,8 @@
|
|||
FROM docker:20.10-cli
|
||||
FROM docker:20.10
|
||||
WORKDIR "/home/librex"
|
||||
|
||||
VOLUME [ "/var/run/docker.sock" ]
|
||||
|
||||
# Docker metadata contains information about the maintainer, such as the name, repository, and support email
|
||||
# Please add any necessary information or correct any incorrect information
|
||||
# See more: https://docs.docker.com/config/labels-custom-metadata/
|
||||
|
@ -80,13 +82,10 @@ RUN chmod u+x "scripts/entrypoint.sh" &&\
|
|||
# Compress Librex files, excluding the '.docker' folder containing scripts and the Dockerfile, using the previously downloaded zip package
|
||||
# Delete all files in the root directory, except for the '.docker' and 'tmp' folders, which are created exclusively to be handled by Docker
|
||||
RUN apk update; apk add zip abuild-rootbld --no-cache &&\
|
||||
rm -rf .git; mkdir -p "tmp/zip" &&\
|
||||
rm -rf .git; mkdir -p "tmp/zip"; mkdir -p "scripts/tmp" &&\
|
||||
zip -r "tmp/zip/librex.zip" . -x "scripts/**\*" "Dockerfile\*" &&\
|
||||
find -maxdepth 1 ! -name "scripts" ! -name "tmp" ! -name "templates" ! -name "." -exec rm -rv {} \; &&\
|
||||
sh -c 'scripts/prepare.sh' && apk del -r zip abuild-rootbld
|
||||
|
||||
RUN docker build --no-cache -t 'nginx:latest' scripts/nginx/nginx.dockerfile &&\
|
||||
docker build --no-cache -t 'php:latest' scripts/php/php.dockerfile
|
||||
|
||||
# Configures the container to be run as an executable.
|
||||
ENTRYPOINT ["/bin/sh", "-c", "scripts/entrypoint.sh"]
|
||||
ENTRYPOINT ["/bin/sh", "-c", "scripts/entrypoint.sh nginx php"]
|
||||
|
|
Loading…
Add table
Reference in a new issue