Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
4b4292b82This file is pinned to the selected release. Download the original to open it in your design tool.
### Enable BuildKit features (e.g. secrets mounts)
# syntax=docker/dockerfile:1.5
FROM --platform=$BUILDPLATFORM kglovernsienci/gsender-pi-builder AS builder
ARG BUILDPLATFORM
ARG NODE_OPTIONS="--max-old-space-size=8192"
ARG USE_SYSTEM_FPM="true"
ARG GITHUB_REF_NAME
ARG GITHUB_REF_TYPE
ARG GIT_COMMIT_LOG
WORKDIR /app
COPY . .
RUN yarn install
RUN npm run package-sync
RUN yarn --cwd src install --production --ignore-scripts --non-interactive
RUN if [ "$GITHUB_REF_TYPE" = "tag" ]; then npm run prebuild-prod; else npm run prebuild-latest; fi
RUN if [ "$GITHUB_REF_TYPE" = "tag" ]; then yarn run build; else yarn run build-latest; fi
RUN --mount=type=secret,id=GH_TOKEN \
export GH_TOKEN="$(cat /run/secrets/GH_TOKEN)" && \
export GITHUB_TOKEN="$GH_TOKEN" && \
yarn run build:linux-arm64
# rename package to PI-64Bit
RUN for f in /app/output/*.deb; do mv "$f" "$(echo "$f" | sed s/arm64/PI-64Bit/)"; done
RUN for f in /app/output/*.AppImage; do mv "$f" "$(echo "$f" | sed s/arm64/PI-64Bit/)"; done
# copy to release
RUN mkdir -p release/pi/
RUN for f in /app/output/*.deb; do cp -af "$f" "$(echo "$f" | sed s/output/release\\/pi/)"; done
RUN for f in /app/output/*.AppImage; do cp -af "$f" "$(echo "$f" | sed s/output/release\\/pi/)"; done
RUN --mount=type=secret,id=GH_TOKEN \
export GH_TOKEN="$(cat /run/secrets/GH_TOKEN)" && \
export GITHUB_TOKEN="$GH_TOKEN" && \
if [[ "$GITHUB_REF_TYPE" == "branch" && "$GITHUB_REF_NAME" == "master" ]]; then \
yarn github-release delete \
--owner=gSender \
--repo=gsender \
--tag="${GITHUB_REF_NAME}-latest" \
--release-name="${GITHUB_REF_NAME}" \
"*-pi*"; \
yarn github-release upload \
--owner=gSender \
--repo=gsender \
--tag="${GITHUB_REF_NAME}-latest" \
--release-name="${GITHUB_REF_NAME}" \
--body="${GIT_COMMIT_LOG}" \
releases/pi/*; \
fi
FROM scratch AS artifact
COPY --from=builder /app/output/*.deb .
COPY --from=builder /app/output/*.AppImage .