From 5f6a4a5c775a67e7fc8b38e125245ea446a89a57 Mon Sep 17 00:00:00 2001 From: Chewing_Bever Date: Sun, 3 Jul 2022 10:46:59 +0200 Subject: [PATCH] Added vlang image --- README.md | 3 +++ vlang/Dockerfile | 50 ++++++++++++++++++++++++++++++++++++++++++++++++ vlang/README.md | 7 +++++++ 3 files changed, 60 insertions(+) create mode 100644 README.md create mode 100644 vlang/Dockerfile create mode 100644 vlang/README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..8113e92 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Dockerfiles + +This repository contains some Dockerfiles I use for various projects. diff --git a/vlang/Dockerfile b/vlang/Dockerfile new file mode 100644 index 0000000..6a1e96e --- /dev/null +++ b/vlang/Dockerfile @@ -0,0 +1,50 @@ +FROM alpine:3.16 + +ARG TARGETPLATFORM + +# Values for release 0.3 +ARG V_COMMIT_HASH=ec758604538c00cceb142d324609a241e665f7c7 +ARG VC_COMMIT_HASH=5dc8384638f515a098f75296fa7123c5e6a4964a + +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 openssl \ + musl-dev \ + openssl-libs-static openssl-dev \ + zlib-static bzip2-static xz-dev expat-static zstd-static lz4-static \ + sqlite-static sqlite-dev \ + libx11-dev glfw-dev freetype-dev \ + libarchive-static libarchive-dev \ + diffutils \ + mandoc unzip + +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"] diff --git a/vlang/README.md b/vlang/README.md new file mode 100644 index 0000000..dbcdae6 --- /dev/null +++ b/vlang/README.md @@ -0,0 +1,7 @@ +# Vlang + +This image I use for CI jobs for all my V-based projects. It's used for +creating static binaries for Vieter, among others. + +It takes the `VC_COMMIT_SHA` & `V_COMMIT_SHA` as build args, with the defaults +being the values for the 0.3 release.