-
Notifications
You must be signed in to change notification settings - Fork 0
/
make.sh
executable file
·32 lines (22 loc) · 874 Bytes
/
make.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
# This script is used to build a Docker image and save it to a tar file for local development testing.
DOCKER_TAG=universal-openvpn:latest
TAR_FILE=universal-openvpn.tar
set -e
# Build the Docker image with the specified tag
docker build --no-cache -t ${DOCKER_TAG} .
# Create a directory to store the image and its layers
mkdir -p build
cd build
# Save the Docker image to a tar file
docker image save ${DOCKER_TAG} > docker_image.tar
# Extract the layer information from the manifest file
LAYER=$(tar Oxf docker_image.tar manifest.json | jq -r ".[].Layers[]")
echo Layer $LAYER
# Create a directory to store the individual layer tar files
mkdir -p single
# Extract the specified layer from the image tar file
tar Oxf docker_image.tar $LAYER > single/layer.tar
# Create a tar file containing the single layer
tar cvf $TAR_FILE single
echo "✅ DONE!"