-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile.aarch64
91 lines (78 loc) · 2.49 KB
/
Dockerfile.aarch64
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# syntax=docker/dockerfile:1
FROM ghcr.io/linuxserver/baseimage-alpine:arm64v8-3.20 as alpine-buildstage
# set version label
ARG UNRAR_VERSION=7.0.9
COPY data.rar /data.rar
RUN \
echo "**** install build dependencies ****" && \
apk add --no-cache --virtual=build-dependencies \
build-base \
linux-headers && \
echo "**** install unrar from source ****" && \
mkdir /tmp/unrar && \
curl -o \
/tmp/unrar.tar.gz -L \
"https://www.rarlab.com/rar/unrarsrc-${UNRAR_VERSION}.tar.gz" && \
tar xf \
/tmp/unrar.tar.gz -C \
/tmp/unrar --strip-components=1 && \
cd /tmp/unrar && \
sed -i 's|LDFLAGS=-pthread|LDFLAGS=-pthread -static|' makefile && \
sed -i 's|CXXFLAGS=-march=native|CXXFLAGS=-march=armv8-a+crypto+crc|' makefile && \
make && \
install -v -m755 unrar /usr/bin && \
echo "**** test binary ****" && \
/usr/bin/unrar v /data.rar && \
/usr/bin/unrar t /data.rar && \
echo "**** cleanup ****" && \
apk del --purge \
build-dependencies && \
rm -rf \
/root/.cache \
/tmp/*
FROM ghcr.io/linuxserver/baseimage-ubuntu:arm64v8-jammy as ubuntu-buildstage
# set version label
ARG UNRAR_VERSION=7.0.9
COPY data.rar /data.rar
RUN \
echo "**** install build dependencies ****" && \
apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
linux-libc-dev && \
echo "**** install unrar from source ****" && \
mkdir /tmp/unrar && \
curl -o \
/tmp/unrar.tar.gz -L \
"https://www.rarlab.com/rar/unrarsrc-${UNRAR_VERSION}.tar.gz" && \
tar xf \
/tmp/unrar.tar.gz -C \
/tmp/unrar --strip-components=1 && \
cd /tmp/unrar && \
sed -i 's|LDFLAGS=-pthread|LDFLAGS=-pthread -static|' makefile && \
sed -i 's|CXXFLAGS=-march=native|CXXFLAGS=-march=armv8-a+crypto+crc|' makefile && \
make && \
install -v -m755 unrar /usr/bin && \
echo "**** test binary ****" && \
/usr/bin/unrar v /data.rar && \
/usr/bin/unrar t /data.rar && \
echo "**** cleanup ****" && \
apt-get remove -y \
build-essential && \
apt-get -y autoremove && \
apt-get clean && \
rm -rf \
/root/.cache \
/tmp/* \
/var/lib/apt/lists/* \
/var/tmp/*
# Storage layer consumed downstream
FROM scratch
# set version label
ARG BUILD_DATE
ARG VERSION
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
LABEL maintainer="aptalca"
# Add files from buildstage
COPY --from=alpine-buildstage /usr/bin/unrar /usr/bin/unrar-alpine
COPY --from=ubuntu-buildstage /usr/bin/unrar /usr/bin/unrar-ubuntu