To build Docker images, use the provided commands, such as docker build -t <image_name>:<tag> --target <stage>
, to create images with specific tags. To push Docker images to a registry, use the docker push
command with the image name and tag, such as docker push briancullinan/quake3e:<tag>
.
docker build -t briancullinan/quake3e:build-tools --target build-tools .
docker build -t briancullinan/quake3e:build-latest --no-cache --target build-latest .
docker build -t briancullinan/quake3e:build-ded --target build-ded .
docker build -t briancullinan/quake3e:build-js --target build-js .
docker build -t briancullinan/quake3e:serve-tools --no-cache --target serve-tools .
docker build -t briancullinan/quake3e:serve-content --target serve-content .
docker build -t briancullinan/quake3e:serve-quake3e --target serve-quake3e .
docker build -t briancullinan/quake3e:serve-both --target serve-both .
docker build -t briancullinan/quake3e:repack --target repack .
docker build -t briancullinan/quake3e:latest --target latest .
docker run -ti -v /Applications/ioquake3/baseq3:/home/baseq3 --name baseq3 briancullinan/quake3e:repack
docker commit baseq3
docker tag baseq3 briancullinan/quake3e:baseq3
docker build -t briancullinan/quake3e:full --target full .
docker push briancullinan/quake3e:build-tools
docker push briancullinan/quake3e:build-latest
docker push briancullinan/quake3e:build-js
docker push briancullinan/quake3e:build-content
docker push briancullinan/quake3e:serve-tools
docker push briancullinan/quake3e:serve-content
docker push briancullinan/quake3e:serve-quake3e
docker push briancullinan/quake3e:serve-both
docker push briancullinan/quake3e:repack
docker push briancullinan/quake3e:latest
docker push briancullinan/quake3e:baseq3
docker push briancullinan/quake3e:full
#!/bin/bash
IMAGE_NAME="briancullinan/quake3e"
TAGS=("build-tools" "build-latest" "build-js" "build-ded" "serve-tools" "serve-content" "serve-quake3e" "serve-both" "repack" "latest" "baseq3" "full")
TARGETS=("build-tools" "build-latest" "build-js" "build-ded" "serve-tools" "serve-content" "serve-quake3e" "serve-both" "repack" "latest" "build-latest" "full")
VOLUME_MOUNT="/Applications/ioquake3/baseq3:/home/baseq3"
for i in "${!TAGS[@]}"; do
build_target=${TARGETS[$i]}
image_tag="${IMAGE_NAME}:${TAGS[$i]}"
# Build the image
echo "Building image ${image_tag} with target ${build_target}"
docker build -t "${image_tag}" --target "${build_target}".
# Push the image
echo "Pushing image ${image_tag}"
docker push "${image_tag}"
done
# Run and commit the container
echo "Running container baseq3 with volume mount ${VOLUME_MOUNT}"
docker run -ti -v ${VOLUME_MOUNT} --name baseq3 ${IMAGE_NAME}:repack
docker commit baseq3
docker tag baseq3 ${IMAGE_NAME}:baseq3
# Build the full image
echo "Building image ${IMAGE_NAME}:full with target full"
docker build -t ${IMAGE_NAME}:full --target full.
docker push ${IMAGE_NAME}:full
These commands build and create Docker images with specific tags.
docker build -t briancullinan/quake3e:build-tools --target build-tools.
* Targets the `build-tools` stage in the Dockerfile.
2. **Build Latest Image**
```bash
docker build -t briancullinan/quake3e:build-latest --no-cache --target build-latest.
build-latest
stage in the Dockerfile.
docker build -t briancullinan/quake3e:build-ded --target build-ded.
* Targets the `build-ded` stage in the Dockerfile.
4. **Build JavaScript Image**
```bash
docker build -t briancullinan/quake3e:build-js --target build-js.
build-js
stage in the Dockerfile.
docker build -t briancullinan/quake3e:serve-tools --no-cache --target serve-tools.
* Targets the `serve-tools` stage in the Dockerfile.
* Does not use the cache for this build.
6. **Serve Content Image**
```bash
docker build -t briancullinan/quake3e:serve-content --target serve-content.
serve-content
stage in the Dockerfile.
docker build -t briancullinan/quake3e:serve-both --target serve-both.
* Targets the `serve-both` stage in the Dockerfile.
8. **Repack Image**
```bash
docker build -t briancullinan/quake3e:repack --target repack.
repack
stage in the Dockerfile.
docker build -t briancullinan/quake3e:latest --target latest.
* Targets the `latest` stage in the Dockerfile.
10. **Full Image**
```bash
docker build -t briancullinan/quake3e:full --target full.
* Targets the `full` stage in the Dockerfile.
These commands run and tag a Docker container.
docker run -ti -v /Applications/ioquake3/baseq3:/home/baseq3 --name baseq3 briancullinan/quake3e:repack
* Runs a container from the `repack` image.
* Maps the host directory `/Applications/ioquake3/baseq3` to the container directory `/home/baseq3`.
* Assigns the container name `baseq3`.
2. **Commit Container**
```bash
docker commit baseq3
baseq3
container.
docker tag baseq3 briancullinan/quake3e:baseq3
* Tags the `baseq3` container with the `briancullinan/quake3e:baseq3` image.
### Push Commands
These commands push Docker images to a registry.
1. **Push Build Tools Image**
```bash
docker push briancullinan/quake3e:build-tools
build-tools
image to the registry.
docker push briancullinan/quake3e:build-latest
* Pushes the `build-latest` image to the registry.
3. **Push Build JavaScript Image**
```bash
docker push briancullinan/quake3e:build-js
build-js
image to the registry.
docker push briancullinan/quake3e:build-content
* Pushes the `build-content` image to the registry.
5. **Push Serve Tools Image**
```bash
docker push briancullinan/quake3e:serve-tools
serve-tools
image to the registry.
docker push briancullinan/quake3e:serve-content
* Pushes the `serve-content` image to the registry.
7. **Push Serve Quake3e Image**
```bash
docker push briancullinan/quake3e:serve-quake3e
serve-quake3e
image to the registry.
docker push briancullinan/quake3e:serve-both
* Pushes the `serve-both` image to the registry.
9. **Push Repack Image**
```bash
docker push briancullinan/quake3e:repack
repack
image to the registry.
docker push briancullinan/quake3e:latest
* Pushes the `latest` image to the registry.
11. **Push Baseq3 Image**
```bash
docker push briancullinan/quake3e:baseq3
* Pushes the `baseq3` image to the registry.
docker push briancullinan/quake3e:full
* Pushes the `full` image to the registry.