From 2846885c7c5eaf3282e7e5f09d7851ad9e91b646 Mon Sep 17 00:00:00 2001 From: James Andariese Date: Sat, 2 Mar 2024 21:16:36 -0600 Subject: [PATCH] add dockerfile --- .github/workflows/build.yaml | 20 ++++++++++++++++++++ Dockerfile | 22 ++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 .github/workflows/build.yaml create mode 100644 Dockerfile diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..f62d105 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,20 @@ +name: Github Actions Demo +run-name: ${{ github.actor }} is testing out GitHub Actions (on Gitea) 🚀 +on: [push] + +jobs: + Explore-Gitea-Actions: + runs-on: metal-docker + steps: + - name: Check out repository code + uses: actions/checkout@v3 + - run: | + ls -la + docker build --progress plain --iidfile iid.txt . + stringprefix() { [ ${#1} -le $2 ] && echo $1 && return 0 || stringprefix "${1%?}" $2 ; } + SHORTSHA="$(stringprefix "$GITHUB_SHA" 8)" + for TAG in "$SHORTSHA" "$GITHUB_REF_NAME";do + docker tag "`cat iid.txt`" "$DOCKER_REGISTRY/$GITHUB_REPOSITORY:$TAG" + docker push "$DOCKER_REGISTRY/$GITHUB_REPOSITORY:$TAG" + done + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f8c5934 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +ARG RELEASE=v0.26.0 +ARG ALPINE=3.19 +ARG GOLANG=1.22 + +FROM golang:${GOLANG}-alpine${ALPINE} AS builder +ARG RELEASE + +RUN apk add --no-cache git +RUN git clone https://github.com/ipfs/kubo -b "release-$RELEASE" +WORKDIR kubo +RUN \ + for cmd in \ + ipfs \ + ipfswatch \ + ;do (cd cmd/$cmd && go build -o /$cmd);done + +FROM alpine:${ALPINE} + +COPY --from=builder /ipfs /bin/ipfs +COPY --from=builder /ipfswatch /bin/ipfswatch + +CMD ["ipfs"]