-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d177a36
commit 177eab4
Showing
4 changed files
with
55 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
cd postgres | ||
./build.sh | ||
|
||
#!/bin/bash | ||
|
||
# Load the cache key from an environment variable | ||
CACHE_KEY=$1 | ||
|
||
# Ensure the Docker buildx builder is set up | ||
docker buildx create --use --name mybuilder | ||
|
||
# Load the cache from the GitHub Actions cache | ||
docker load -i /tmp/docker_cache_$CACHE_KEY.tar || true | ||
|
||
#cd postgres | ||
#./build.sh | ||
|
||
|
||
# Set variables | ||
CONTAINER_NAME="postgres_builder" | ||
IMAGE_NAME="postgres-builder:latest" | ||
|
||
# # Check if the container is already running | ||
# if [ "$(docker ps -q -f name=$CONTAINER_NAME)" ]; then | ||
# echo "Stopping and removing existing container $CONTAINER_NAME..." | ||
# #docker stop $CONTAINER_NAME | ||
# docker rm $CONTAINER_NAME --force | ||
# fi | ||
|
||
# Build the preparation Docker image | ||
docker build -t $IMAGE_NAME ./postgres | ||
|
||
# Run the container with Docker socket | ||
docker run --name $CONTAINER_NAME --rm -v /var/run/docker.sock:/var/run/docker.sock -v /tmp:/tmp -e CACHE_KEY=$CACHE_KEY $IMAGE_NAME | ||
|
||
|
||
|
||
# Build the Docker image with cache | ||
#docker buildx build --cache-from type=local,src=/tmp/docker_cache_$CACHE_KEY --cache-to type=local,dest=/tmp/docker_cache_$CACHE_KEY,mode=max -t myimage:latest . | ||
|
||
# Save the cache to a tar file | ||
docker save -o /tmp/docker_cache_$CACHE_KEY.tar pg-ferret-postgres-16:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters