Skip to content

Commit c954a82

Browse files
committed
Add makefile to demo pushing to registries
1 parent 92f640e commit c954a82

4 files changed

Lines changed: 29 additions & 2 deletions

File tree

‎06-building-container-images/Makefile‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ CMD and ENTRYPOINT.
5050

5151
The image has the following:
5252

53-
ENTRYPOINT [ "echo", "Hey Team 👋 (entrypoint)" ]
54-
CMD [ "+ (cmd)" ]
53+
ENTRYPOINT [ "echo", "Hey Team 👋 (entrypoint)" ]
54+
CMD [ "+ (cmd)" ]
5555

5656
✅✅✅✅✅✅✅✅✅✅✅✅✅✅✅✅✅✅✅✅✅✅✅✅✅✅✅✅✅✅
5757

‎06-building-container-images/client-react/Dockerfile.5‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# syntax=docker/dockerfile:1.5
2+
13
FROM node:19.4-bullseye AS build
24

35
# Specify working directory other than /

‎07-container-registries/Dockerfile‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Empty dockerfile to demonstrate pushing to registries
2+
FROM scratch

‎07-container-registries/Makefile‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.PHONY: build
2+
build:
3+
docker build --tag my-scratch-image .
4+
5+
# Have to authenticate to dockerhub and create repo first:
6+
# https://docs.docker.com/engine/reference/commandline/login/
7+
.PHONY: push-dockerhub
8+
push-dockerhub: build
9+
docker tag my-scratch-image sidpalas/my-scratch-image # defaults to latest
10+
docker push sidpalas/my-scratch-image
11+
12+
docker tag my-scratch-image sidpalas/my-scratch-image:abc-123 # defaults to latest
13+
docker push sidpalas/my-scratch-image:abc-123
14+
15+
# Have to authenticate to ghcr.io first
16+
# https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#authenticating-to-the-container-registry
17+
.PHONY: push-github-packages
18+
push-github-packages: build
19+
docker tag my-scratch-image ghcr.io/sidpalas/my-scratch-image # defaults to latest
20+
docker push ghcr.io/sidpalas/my-scratch-image
21+
22+
docker tag my-scratch-image ghcr.io/sidpalas/my-scratch-image:abc-123 # defaults to latest
23+
docker push ghcr.io/sidpalas/my-scratch-image:abc-123

0 commit comments

Comments
 (0)