-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: top arg only on from include before stage
- Loading branch information
Showing
20 changed files
with
121 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module.exports = function parseDockerfileXStartComment(line) { | ||
const prefix = "# DOCKERFILE-X:START " | ||
|
||
if (!line.startsWith(prefix)) { | ||
return null | ||
} | ||
|
||
const keyValueString = line.slice(prefix.length) | ||
const keyValuePairs = keyValueString.split(/\s+/) | ||
const map = {} | ||
|
||
keyValuePairs.forEach((pair) => { | ||
const [key, value] = pair.split("=") | ||
if (key && value) { | ||
const cleanedValue = value.replace(/^["']|["']$/g, "") | ||
map[key] = cleanedValue | ||
} | ||
}) | ||
return map | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
test/__snapshots__/FROM/fromIncludeArg.expected.dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
ARG UBUNTU_VERSION=22.04 | ||
FROM debian AS node | ||
ARG NODE_VERSION=20.3.0 | ||
ARG NODE_PACKAGE=node-v$NODE_VERSION-linux-x64 | ||
RUN curl https://nodejs.org/dist/v$NODE_VERSION/$NODE_PACKAGE.tar.gz | tar -xzC /opt/ && mv /opt/$NODE_PACKAGE /opt/node | ||
# DOCKERFILE-X:START file="./inc/ubuntu.dockerfile" includedBy="fromIncludeArg.dockerfile" includeType="from" | ||
ARG UBUNTU_VERSION=22.04 | ||
FROM ubuntu:$UBUNTU_VERSION AS ubuntu9e4275--final-stage | ||
FROM ubuntu9e4275--final-stage AS ubuntu9e4275 | ||
RUN groupadd -g 1000 ubuntu && useradd -rm -d /home/ubuntu -s /bin/bash -g ubuntu -G sudo -u 1000 ubuntu | ||
ENV HOME=/home/ubuntu | ||
RUN chmod 0777 /home/ubuntu | ||
RUN mkdir /app && chown 1000:1000 /app | ||
# DOCKERFILE-X:END file="./inc/ubuntu.dockerfile" includedBy="fromIncludeArg.dockerfile" includeType="from" | ||
FROM ubuntu9e4275 AS final-stage | ||
COPY --from=node /opt/node /opt/node |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.