dockerfiles/vlang/Dockerfile

54 lines
1.5 KiB
Docker
Raw Normal View History

2023-01-15 20:09:53 +01:00
FROM alpine:3.17
2022-07-03 10:46:59 +02:00
ARG TARGETPLATFORM
2023-01-15 20:09:53 +01:00
# Values for release 0.3.2
ARG V_COMMIT_HASH=135b1ccb14699a458575f1d63aa8d1cd4afa3b7a
ARG VC_COMMIT_HASH=f96a25aee506a6025d716c8520c0a492374081c6
2022-07-03 10:46:59 +02:00
ENV VVV /opt/vlang
ENV PATH /opt/vlang:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENV VFLAGS -cc gcc -gc none
RUN apk --no-cache add \
git make gcc curl musl-dev \
openssl openssl-libs-static openssl-dev \
2022-07-03 10:46:59 +02:00
sqlite-static sqlite-dev \
libarchive-static libarchive-dev \
2023-01-15 20:09:53 +01:00
zlib-static zlib-dev \
bzip2-static bzip2-dev \
xz-static xz-dev \
expat-static expat-dev \
zstd zstd-dev \
lz4-static lz4-dev \
2022-07-03 10:46:59 +02:00
diffutils \
2023-01-15 20:09:53 +01:00
mandoc unzip clang15-extra-tools
2022-07-03 10:46:59 +02:00
WORKDIR /opt
RUN curl -Lo v.zip "https://github.com/vlang/v/archive/${V_COMMIT_HASH}.zip" && \
unzip v.zip && \
rm v.zip && \
mv "v-${V_COMMIT_HASH}" vlang
WORKDIR /opt/vlang
# We use zip instead of git for the vc repository here because cloning it
# requires pulling down over 600MB of Git history.
RUN curl -Lo vc.zip "https://github.com/vlang/vc/archive/${VC_COMMIT_HASH}.zip" && \
unzip vc.zip && \
rm vc.zip && \
mv "vc-${VC_COMMIT_HASH}" vc && \
make fresh_tcc && \
make local=1 prod=1 && \
ln -s /opt/vlang/v /usr/bin/v
# This is used to upload the resulting static binaries to my Minio instance.
# There are however only builds available for amd64.
RUN if [ "$TARGETPLATFORM" = 'linux/amd64' ]; then \
wget -O /usr/local/bin/mc https://dl.min.io/client/mc/release/linux-amd64/mc && \
chmod +x /usr/local/bin/mc ; \
fi
CMD ["v"]