Add files

Add files

Signed-off-by: Bensuperpc <bensuperpc@gmail.com>
pull/1/head
Bensuperpc 2 years ago
parent b28108fa14
commit abc9f6372c

@ -0,0 +1 @@
github: bensuperpc

@ -0,0 +1,9 @@
# Set update schedule for GitHub Actions
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every weekday
interval: "daily"

@ -0,0 +1,48 @@
name: docker-sjasmplus
on:
push:
branches:
- 'main'
- 'master'
- 'dev'
paths-ignore:
- '**/README.md'
pull_request:
branches:
- '*'
schedule:
- cron: "0 7 * * 4"
workflow_dispatch:
jobs:
image:
name: docker-sjasmplus
runs-on: ubuntu-20.04
strategy:
# max-parallel: 8
fail-fast: false
matrix:
arch_type:
- "linux/amd64"
- "linux/386"
- "linux/arm64"
- "linux/ppc64le"
- "linux/s390x"
- "linux/arm/v7"
- "linux/arm/v6"
steps:
- name: "📥 Checkout Code"
uses: actions/checkout@v2.3.4
with:
submodules: 'recursive'
fetch-depth: 0
- name: "🛠️ Docker QEMU"
run: make qemu
- name: "🛠️ Build and 📤 Upload to hub.docker.com"
run: |
docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASS }}
make ${{ matrix.arch_type }}
- name: "🧹 Clean"
run: make clean

@ -0,0 +1,39 @@
ARG DOCKER_IMAGE=alpine:latest
FROM $DOCKER_IMAGE AS builder
RUN apk add --no-cache gcc g++ make ninja boost-dev cmake git \
&& git clone --recurse-submodules https://github.com/sjasmplus/sjasmplus.git
WORKDIR /sjasmplus
RUN mkdir -p build && cd build && cmake -GNinja .. && ninja
ARG DOCKER_IMAGE=alpine:latest
FROM $DOCKER_IMAGE AS runtime
LABEL author="Bensuperpc <bensuperpc@gmail.com>"
LABEL mantainer="Bensuperpc <bensuperpc@gmail.com>"
ARG VERSION="1.0.0"
ENV VERSION=$VERSION
RUN apk add libgcc libstdc++ --no-cache make
COPY --from=builder /sjasmplus/build /usr/local
ENV PATH="/usr/local:${PATH}"
ENV CC=/usr/local/bin/sjasmplus
WORKDIR /usr/src/myapp
CMD ["sjasmplus"]
LABEL org.label-schema.schema-version="1.0" \
org.label-schema.build-date=$BUILD_DATE \
org.label-schema.name="bensuperpc/docker-sjasmplus" \
org.label-schema.description="build tinycc compiler" \
org.label-schema.version=$VERSION \
org.label-schema.vendor="Bensuperpc" \
org.label-schema.url="http://bensuperpc.com/" \
org.label-schema.vcs-url="https://github.com/Bensuperpc/docker-sjasmplus" \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.docker.cmd="docker build -t bensuperpc/sjasmplus -f Dockerfile ."

@ -0,0 +1,61 @@
#//////////////////////////////////////////////////////////////
#// ____ //
#// | __ ) ___ _ __ ___ _ _ _ __ ___ _ __ _ __ ___ //
#// | _ \ / _ \ '_ \/ __| | | | '_ \ / _ \ '__| '_ \ / __| //
#// | |_) | __/ | | \__ \ |_| | |_) | __/ | | |_) | (__ //
#// |____/ \___|_| |_|___/\__,_| .__/ \___|_| | .__/ \___| //
#// |_| |_| //
#//////////////////////////////////////////////////////////////
#// //
#// Script, 2021 //
#// Created: 02, June, 2021 //
#// Modified: 03, June, 2021 //
#// file: - //
#// - //
#// Source: https://github.com/sjasmplus/sjasmplus //
#// https://www.docker.com/blog/getting-started-with-docker-for-arm-on-linux/
#// https://schinckel.net/2021/02/12/docker-%2B-makefile/
#// https://www.padok.fr/en/blog/multi-architectures-docker-iot
#// OS: ALL //
#// CPU: ALL //
#// //
#//////////////////////////////////////////////////////////////
BASE_IMAGE := alpine:latest
IMAGE_NAME := bensuperpc/sjasmplus
DOCKERFILE := Dockerfile
DOCKER := docker
TAG := $(shell date '+%Y%m%d')-$(shell git rev-parse --short HEAD)
DATE_FULL := $(shell date -u +"%Y-%m-%dT%H:%M:%SZ)
UUID := $(shell cat /proc/sys/kernel/random/uuid)
VERSION := 1.0.0
ARCH_LIST := linux/amd64 linux/arm64 linux/ppc64le linux/s390x linux/386 linux/arm/v7 linux/arm/v6
comma:= ,
COM_ARCH_LIST:= $(subst $() $(),$(comma),$(ARCH_LIST))
$(ARCH_LIST): $(DOCKERFILE)
$(DOCKER) buildx build . -f $(DOCKERFILE) -t $(IMAGE_NAME):$(TAG) -t $(IMAGE_NAME):latest \
--build-arg BUILD_DATE=$(DATE_FULL) --build-arg DOCKER_IMAGE=$(BASE_IMAGE) --platform $@ \
--build-arg VERSION=$(VERSION) --push
all: $(DOCKERFILE)
$(DOCKER) buildx build . -f $(DOCKERFILE) -t $(IMAGE_NAME):$(TAG) -t $(IMAGE_NAME):latest \
--build-arg BUILD_DATE=$(DATE_FULL) --build-arg DOCKER_IMAGE=$(BASE_IMAGE) --platform $(COM_ARCH_LIST) \
--build-arg VERSION=$(VERSION) --push
push: all
# https://github.com/linuxkit/linuxkit/tree/master/pkg/binfmt
qemu:
export DOCKER_CLI_EXPERIMENTAL=enabled
$(DOCKER) run --rm --privileged linuxkit/binfmt:v0.8
$(DOCKER) buildx create --name mybuilder --driver docker-container --use
$(DOCKER) buildx inspect --bootstrap
clean:
$(DOCKER) images --filter='reference=$(IMAGE_NAME)' --format='{{.Repository}}:{{.Tag}}' | xargs -r $(DOCKER) rmi -f
.PHONY: build push clean qemu $(ARCH_LIST)

@ -0,0 +1,43 @@
#!/bin/bash
#//////////////////////////////////////////////////////////////
#// ____ //
#// | __ ) ___ _ __ ___ _ _ _ __ ___ _ __ _ __ ___ //
#// | _ \ / _ \ '_ \/ __| | | | '_ \ / _ \ '__| '_ \ / __| //
#// | |_) | __/ | | \__ \ |_| | |_) | __/ | | |_) | (__ //
#// |____/ \___|_| |_|___/\__,_| .__/ \___|_| | .__/ \___| //
#// |_| |_| //
#//////////////////////////////////////////////////////////////
#// //
#// Script, 2021 //
#// Created: 03, June, 2021 //
#// Modified: 03, June, 2021 //
#// file: - //
#// - //
#// Source: - //
#// OS: ALL //
#// CPU: ALL //
#// //
#//////////////////////////////////////////////////////////////
TAG_VERSION=latest
DOCKER_IMAGE=bensuperpc/sjasmplus
case "$1" in
-version|-v)
TAG_VERSION=$2
shift
shift
;;&
-h)
echo "Usage: ${0##*/} [-version latest sjasmplus -o hello hello.c]"
exit 1
;;
esac
if [ $# -eq 0 ]
then
echo "No arguments supplied"
exit 1
fi
docker run --rm -v "$PWD":/usr/src/myapp -w /usr/src/myapp ${DOCKER_IMAGE}:${TAG_VERSION} $@
Loading…
Cancel
Save