Skip to content

Commit

Permalink
🍷
Browse files Browse the repository at this point in the history
  • Loading branch information
w13b3 committed Apr 6, 2024
1 parent 596ed22 commit f9f7656
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 16 deletions.
5 changes: 3 additions & 2 deletions Dockerfile.redbean-alpine
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# syntax=docker/dockerfile:1
# # FROM args
ARG GIT_REPO_OWNER=none
ARG BUILD_TAG=latest
ARG ALPINE_TAG=3.19.1
ARG IMAGE_TAG=latest

# # build image
FROM redbean-build:${IMAGE_TAG} AS build
FROM ghcr.io/${GIT_REPO_OWNER}/redbean-build:${BUILD_TAG} AS build

# # final image
FROM docker.io/library/alpine:${ALPINE_TAG} AS final
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.redbean-build
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# syntax=docker/dockerfile:1
# # FROM args
ARG DEBIAN_TAG=bookworm-20240311-slim
ARG BUILD_DEBIAN_TAG=bookworm-20240311-slim

# # # build stage
FROM docker.io/library/debian:${DEBIAN_TAG} AS build
FROM docker.io/library/debian:${BUILD_DEBIAN_TAG} AS build

# # environment variables
ENV LANG=C.UTF-8
Expand Down
5 changes: 3 additions & 2 deletions Dockerfile.redbean-scratch
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# syntax=docker/dockerfile:1
# # FROM args
ARG IMAGE_TAG=latest
ARG GIT_REPO_OWNER=none
ARG BUILD_TAG=latest

# # build image
FROM redbean-build:${IMAGE_TAG} AS build
FROM ghcr.io/${GIT_REPO_OWNER}/redbean-build:${BUILD_TAG} AS build

# # normalize the binary to ELF
RUN --network=none <<EOT
Expand Down
38 changes: 28 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ SHELL := /usr/bin/env sh


# # # Default variables

MODE ?= optlinux
REDBEAN_VERSION ?= latest

IMAGE_TAG ?= latest
DEBIAN_TAG ?= bookworm-20240311-slim
BUILD_TAG ?= latest
BUILD_DEBIAN_TAG ?= bookworm-20240311-slim
ALPINE_TAG ?= 3.19.1

GIT_REPO_OWNER ?= none


# # # Help

Expand All @@ -21,6 +24,7 @@ help:
@echo " all"
@echo " lint-dockerfile FILE"
@echo " lint-all"
@echo " redbean"
@echo " redbean-build"
@echo " redbean-alpine"
@echo " redbean-scratch"
Expand All @@ -29,30 +33,44 @@ help:
# # # Default goal

.PHONY: all
all: lint-all
all: redbean
$(info Done running 'make all')


# # # Build

.PHONY: redbean
redbean: redbean-scratch
$(info Done running 'make redbean')

.PHONY: redbean-build
redbean-build:
DOCKER_BUILDKIT=1 docker buildx build $(CURDIR) \
--tag=$@:$(IMAGE_TAG) \
--load \
--file=$(CURDIR)/Dockerfile.redbean-build \
--build-arg=DEBIAN_TAG=$(DEBIAN_TAG) \
--build-arg=MODE=$(MODE)
--build-arg=MODE=$(MODE) \
--build-arg=BUILD_DEBIAN_TAG=$(BUILD_DEBIAN_TAG) \
--tag=redbean-build:$(BUILD_TAG) \
--tag=ghcr.io/$(GIT_REPO_OWNER)/redbean-build:$(BUILD_TAG)

redbean-alpine: redbean-build
DOCKER_BUILDKIT=1 docker buildx build $(CURDIR) \
--load \
--file=$(CURDIR)/Dockerfile.redbean-alpine \
--build-arg=ALPINE_TAG=$(ALPINE_TAG) \
--build-arg=GIT_REPO_OWNER=$(GIT_REPO_OWNER) \
--build-arg=BUILD_TAG=$(BUILD_TAG) \
--tag=redbean:$(REDBEAN_VERSION)-alpine \
--file=$(CURDIR)/Dockerfile.redbean-alpine \
--build-arg=ALPINE_TAG=$(ALPINE_TAG)
--tag=ghcr.io/$(GIT_REPO_OWNER)/redbean:$(REDBEAN_VERSION)-alpine

redbean-scratch: redbean-build
DOCKER_BUILDKIT=1 docker buildx build $(CURDIR) \
--tag=redbean:$(REDBEAN_VERSION)-scratch \
--file=$(CURDIR)/Dockerfile.redbean-scratch
--load \
--file=$(CURDIR)/Dockerfile.redbean-scratch \
--build-arg=GIT_REPO_OWNER=$(GIT_REPO_OWNER) \
--build-arg=BUILD_TAG=$(BUILD_TAG) \
--tag=redbean:$(REDBEAN_VERSION) \
--tag=ghcr.io/$(GIT_REPO_OWNER)/redbean:$(REDBEAN_VERSION)


# # # Lint the Dockerfile
Expand Down

0 comments on commit f9f7656

Please sign in to comment.