Add support for the CROSS_BUILD instruction set

This commit is contained in:
Camden Cheek 2021-05-11 08:47:20 -06:00
parent 215639ff94
commit 3a6c457095
No known key found for this signature in database
GPG key ID: 595BFFE3A04E48B9
8 changed files with 4219 additions and 4016 deletions

11
corpus/cross_build.txt Normal file
View file

@ -0,0 +1,11 @@
==================
Simple
==================
CROSS_BUILD_COPY qemu-QEMUARCH-static /usr/bin/
---
(source_file
(cross_build_instruction))

21
examples/7 Normal file
View file

@ -0,0 +1,21 @@
FROM opuscapita/minsk-core-ci:1
# install az
# get rid of warnings about missing terminal etc.
ENV DEBIAN_FRONTEND noninteractive
# Install Azure CLI according to https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-apt?view=azure-cli-latest
RUN curl -sL https://aka.ms/InstallAzureCLIDeb | bash
# install Kubectl
ARG KUBECTL_VERSION=1.17.7
RUN curl -fLk -o /usr/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl \
&& chmod +x /usr/bin/kubectl
# Install Helm
ARG HELM_VERSION=2.17.0
RUN curl -fLk -o /usr/bin/helm.tar.gz https://storage.googleapis.com/kubernetes-helm/helm-v${HELM_VERSION}-linux-amd64.tar.gz \
&& cd /usr/bin && tar -xzf ./helm.tar.gz --strip-components=1 -C . linux-amd64/helm \
&& chmod +x /usr/bin/helm \
&& rm -rf /usr/bin/helm.tar.gz

4
examples/8 Normal file
View file

@ -0,0 +1,4 @@
FROM scratch
LABEL maintainer="fabio@vmware.com"
COPY govc /
ENTRYPOINT [ "/govc"

27
examples/9 Normal file
View file

@ -0,0 +1,27 @@
# Copyright 2017 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
ARG BASEIMAGE
FROM $BASEIMAGE
CROSS_BUILD_COPY qemu-QEMUARCH-static /usr/bin/
RUN apt-get update && apt-get install -y --no-install-recommends \
cuda-samples-$CUDA_PKG_VERSION && \
rm -rf /var/lib/apt/lists/*
WORKDIR /usr/local/cuda/samples/0_Simple/vectorAdd
RUN make
CMD nvidia-smi && ./vectorAdd

View file

@ -29,6 +29,7 @@ module.exports = grammar({
$.healthcheck_instruction,
$.shell_instruction,
$.maintainer_instruction,
$.cross_build_instruction,
),
from_instruction: $ => seq(
@ -193,6 +194,11 @@ module.exports = grammar({
/.*/,
),
cross_build_instruction: $ => seq(
alias(/[cC][rR][oO][sS][sS]_[bB][uU][iI][lL][dD][a-zA-Z_]*/, "CROSS_BUILD"),
/.*/,
),
path: $ => seq(
choice(
/[^-\s\$]/, // cannot start with a '-' to avoid conflicts with params

View file

@ -91,6 +91,10 @@
{
"type": "SYMBOL",
"name": "maintainer_instruction"
},
{
"type": "SYMBOL",
"name": "cross_build_instruction"
}
]
},
@ -797,6 +801,24 @@
}
]
},
"cross_build_instruction": {
"type": "SEQ",
"members": [
{
"type": "ALIAS",
"content": {
"type": "PATTERN",
"value": "[cC][rR][oO][sS][sS]_[bB][uU][iI][lL][dD][a-zA-Z_]*"
},
"named": false,
"value": "CROSS_BUILD"
},
{
"type": "PATTERN",
"value": ".*"
}
]
},
"path": {
"type": "SEQ",
"members": [

View file

@ -91,6 +91,11 @@
]
}
},
{
"type": "cross_build_instruction",
"named": true,
"fields": {}
},
{
"type": "double_quoted_string",
"named": true,
@ -432,6 +437,10 @@
"type": "copy_instruction",
"named": true
},
{
"type": "cross_build_instruction",
"named": true
},
{
"type": "entrypoint_instruction",
"named": true
@ -597,6 +606,10 @@
"type": "copy_instruction",
"named": true
},
{
"type": "cross_build_instruction",
"named": true
},
{
"type": "entrypoint_instruction",
"named": true
@ -825,6 +838,10 @@
"type": "COPY",
"named": false
},
{
"type": "CROSS_BUILD",
"named": false
},
{
"type": "ENTRYPOINT",
"named": false

File diff suppressed because it is too large Load diff