-
Notifications
You must be signed in to change notification settings - Fork 97
Expand file tree
/
Copy pathDockerfilePi
More file actions
55 lines (48 loc) · 2.03 KB
/
DockerfilePi
File metadata and controls
55 lines (48 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
### 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 .