Skip to content

Commit

Permalink
🩹
Browse files Browse the repository at this point in the history
  • Loading branch information
w13b3 committed Apr 5, 2024
1 parent fec315b commit 596ed22
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
27 changes: 27 additions & 0 deletions Dockerfile.redbean-scratch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# syntax=docker/dockerfile:1
# # FROM args
ARG IMAGE_TAG=latest

# # build image
FROM redbean-build:${IMAGE_TAG} AS build

# # normalize the binary to ELF
RUN --network=none <<EOT
redbean --assimilate
EOT

# # basically no-op image
FROM scratch AS final

# # final args
ARG BIN_DIR=/usr/local/bin

# # environment variables
ENV LANG=C.UTF-8
ENV PATH=${BIN_DIR}

# # only copy redbean
COPY --from=build ${BIN_DIR}/redbean ${BIN_DIR}/redbean

# # start redbean when running the container
ENTRYPOINT [ "redbean" ]
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ help:
@echo " lint-all"
@echo " redbean-build"
@echo " redbean-alpine"
@echo " redbean-scratch"


# # # Default goal
Expand All @@ -48,6 +49,11 @@ redbean-alpine: redbean-build
--file=$(CURDIR)/Dockerfile.redbean-alpine \
--build-arg=ALPINE_TAG=$(ALPINE_TAG)

redbean-scratch: redbean-build
DOCKER_BUILDKIT=1 docker buildx build $(CURDIR) \
--tag=redbean:$(REDBEAN_VERSION)-scratch \
--file=$(CURDIR)/Dockerfile.redbean-scratch


# # # Lint the Dockerfile

Expand All @@ -63,8 +69,8 @@ else
--network=none \
--volume="$(CURDIR)/.hadolint.yml:/.hadolint.yml:ro" \
hadolint/hadolint < $(FILE)
$(info No errors found in '$(FILE)')
endif


.PHONY: lint-all lint-all-%
lint-all: $(foreach FILE, $(wildcard $(CURDIR)/Dockerfile*), lint-all-$(notdir $(FILE)))
Expand Down

0 comments on commit 596ed22

Please sign in to comment.