Skip to content

Commit

Permalink
Update Dockerfile
Browse files Browse the repository at this point in the history
Signed-off-by: Zoey <[email protected]>
  • Loading branch information
Zoey2936 authored Jun 21, 2024
1 parent 49ca72e commit 8329f05
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ARG PT_VERSION=v6.1.0 \
TARGETARCH

RUN apk upgrade --no-cache -a && \
apk add --no-cache ca-certificates bash git nodejs yarn npm python3 && \
apk add --no-cache ca-certificates bash git nodejs yarn npm python3 file && \
yarn global add clean-modules && \
git clone --recursive https://github.com/Chocobozzz/PeerTube --branch "$PT_VERSION" /app && \
sed -i "s|gosu|su-exec|g" /app/support/docker/production/entrypoint.sh && \
Expand All @@ -17,23 +17,30 @@ RUN apk upgrade --no-cache -a && \
npm_config_target_platform=linux npm_config_target_arch=x64 yarn install --pure-lockfile && \
npm_config_target_platform=linux npm_config_target_arch=x64 npm run build && \
rm -vr /app/client/.angular /app/client/node_modules /app/node_modules && \
npm_config_target_platform=linux npm_config_target_arch=x64 yarn install --pure-lockfile --production; \
npm_config_target_platform=linux npm_config_target_arch=x64 yarn install --pure-lockfile --production && \
for file in $(find /app/node_modules -name "*.node" -exec file {} \; | grep -v "x86-64" | sed "s|\(.*\):.*|\1|g"); do rm -v "$file"; done; \
elif [ "$TARGETARCH" = "arm64" ]; then \
cd /app/client && \
npm_config_target_platform=linux npm_config_target_arch=arm64 yarn install --pure-lockfile && \
cd /app && \
npm_config_target_platform=linux npm_config_target_arch=arm64 yarn install --pure-lockfile && \
npm_config_target_platform=linux npm_config_target_arch=arm64 npm run build && \
rm -vr /app/client/.angular /app/client/node_modules /app/node_modules && \
npm_config_target_platform=linux npm_config_target_arch=arm64 yarn install --pure-lockfile --production; \
npm_config_target_platform=linux npm_config_target_arch=arm64 yarn install --pure-lockfile --production && \
for file in $(find /app/node_modules -name "*.node" -exec file {} \; | grep -v "aarch64" | sed "s|\(.*\):.*|\1|g"); do rm -v "$file"; done; \
fi && \
clean-modules --yes && \
yarn cache clean --all
yarn cache clean --all && \
clean-modules --yes
FROM alpine:3.20.1 AS strip
COPY --from=build-backend /app /app
RUN apk upgrade --no-cache -a && \
apk add --no-cache ca-certificates binutils file && \
find /app/node_modules -name "*.node" -exec strip -s {} \; && \
find /app/node_modules -name "*.node" -exec file {} \;

FROM alpine:3.20.1
COPY --chown=1000:1000 --from=build /app /app
COPY --chown=1000:1000 --from=strip /app /app
WORKDIR /app

RUN apk add --no-cache ca-certificates tzdata tini su-exec nodejs yarn ffmpeg shadow && \
groupadd -r peertube && \
useradd -r -g peertube -m peertube && \
Expand Down

0 comments on commit 8329f05

Please sign in to comment.