forked from vercel/pkg-fetch
-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Dockerfile.alpine
49 lines (36 loc) · 1.18 KB
/
Dockerfile.alpine
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
ARG HOST_ARCH=x86_64
ARG TARGET_TRIPLE=aarch64-linux-musl
FROM muslcc/$HOST_ARCH:$TARGET_TRIPLE AS build
ARG PKG_FETCH_OPTION_a
ARG PKG_FETCH_OPTION_n
ARG PKG_FETCH_OPTION_p
USER root:root
WORKDIR /root/pkg-fetch/
# HAXX upgrade alpine here because the muslcc image
# is built on an old image and no newer version is available
RUN sed -i -e 's/v3\.14/v3\.20/g' /etc/apk/repositories && \
apk update && \
apk add --upgrade apk-tools && \
apk upgrade --available
RUN apk add --no-cache build-base git linux-headers npm python3 yarn
# https://gitlab.alpinelinux.org/alpine/aports/-/issues/8626
ENV CFLAGS=-U_FORTIFY_SOURCE
ENV CFLAGS_host=-U_FORTIFY_SOURCE
ENV CXXFLAGS=-U_FORTIFY_SOURCE
ENV CXXFLAGS_host=-U_FORTIFY_SOURCE
ENV CC=/bin/gcc
ENV CXX=/bin/g++
ENV AR=/bin/ar
ENV NM=/bin/nm
ENV READELF=/bin/readelf
ENV STRIP=/bin/strip
ENV CC_host=/usr/bin/gcc
ENV CXX_host=/usr/bin/g++
ENV AR_host=/usr/bin/ar
ENV NM_host=/usr/bin/nm
ENV READELF_host=/usr/bin/readelf
COPY . ./
RUN yarn install --ignore-engines
RUN yarn start --arch $PKG_FETCH_OPTION_a --node-range $PKG_FETCH_OPTION_n --platform $PKG_FETCH_OPTION_p --output dist
FROM scratch
COPY --from=build /root/pkg-fetch/dist /