Add makefile to demo pushing to registries

This commit is contained in:
sid palas
2023-02-20 10:15:40 -05:00
parent 92f640e252
commit c954a8205a
4 changed files with 29 additions and 2 deletions

View File

@ -1,3 +1,5 @@
# syntax=docker/dockerfile:1.5
FROM node:19.4-bullseye AS build FROM node:19.4-bullseye AS build
# Specify working directory other than / # Specify working directory other than /

View File

@ -0,0 +1,2 @@
# Empty dockerfile to demonstrate pushing to registries
FROM scratch

View File

@ -0,0 +1,23 @@
.PHONY: build
build:
docker build --tag my-scratch-image .
# Have to authenticate to dockerhub and create repo first:
# https://docs.docker.com/engine/reference/commandline/login/
.PHONY: push-dockerhub
push-dockerhub: build
docker tag my-scratch-image sidpalas/my-scratch-image # defaults to latest
docker push sidpalas/my-scratch-image
docker tag my-scratch-image sidpalas/my-scratch-image:abc-123 # defaults to latest
docker push sidpalas/my-scratch-image:abc-123
# Have to authenticate to ghcr.io first
# https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#authenticating-to-the-container-registry
.PHONY: push-github-packages
push-github-packages: build
docker tag my-scratch-image ghcr.io/sidpalas/my-scratch-image # defaults to latest
docker push ghcr.io/sidpalas/my-scratch-image
docker tag my-scratch-image ghcr.io/sidpalas/my-scratch-image:abc-123 # defaults to latest
docker push ghcr.io/sidpalas/my-scratch-image:abc-123