Markdown 语法高亮可以支持 dockerfile 吗?

Viewed 1453

图片.png

高亮不支持 dockerfile

FROM python:3.9-buster
RUN (apt-get update) && (apt-get install -y libgl1-mesa-dev ffmpeg libsm6 libxext6)
ENV PYTHONUNBUFFERED 1
RUN mkdir /code
WORKDIR /code
COPY requirements.txt /code/
RUN (/usr/local/bin/python -m pip install --upgrade pip -i https://mirrors.aliyun.com/pypi/simple) && (pip install -i https://mirrors.aliyun.com/pypi/simple -r requirements.txt)
COPY . /code/

我反馈一下

1 Answers

dockerfile 的文件格式是 yaml

回答更正:

官方 Demo

FROM ubuntu:14.04
MAINTAINER example@example.com
ENV foo /bar
WORKDIR ${foo}   # WORKDIR /bar
ADD . $foo       # ADD . /bar
COPY \$foo /quux # COPY $foo /quux
ARG   VAR=FOO
RUN apt-get update && apt-get install -y software-properties-common\
    zsh curl wget git htop\
    unzip vim telnet
RUN ["/bin/bash", "-c", "echo hello ${USER}"]
CMD ["executable","param1","param2"]
CMD command param1 param2
EXPOSE 1337
ENV myName="John Doe" myDog=Rex\ The\ Dog \
    myCat=fluffy
ENV myName John Doe
ENV myDog Rex The Dog
ENV myCat fluffy
ADD hom* /mydir/        # adds all files starting with "hom"
ADD hom?.txt /mydir/    # ? is replaced with any single character
COPY hom* /mydir/        # adds all files starting with "hom"
COPY hom?.txt /mydir/    # ? is replaced with any single character
COPY --from=foo / .
ENTRYPOINT ["executable", "param1", "param2"]
ENTRYPOINT command param1 param2
VOLUME ["/data"]
USER daemon
LABEL com.example.label-with-value="foo"
LABEL version="1.0"
LABEL description="This text illustrates \
that label-values can span multiple lines."
WORKDIR /path/to/workdir
ONBUILD ADD . /app/src
STOPSIGNAL SIGKILL
HEALTHCHECK --retries=3 cat /health
SHELL ["/bin/bash", "-c"]

经测试发下,这段代码有异常,影响了高亮

RUN /usr/local/bin/python -m pip install --upgrade pip -i https://mirrors.aliyun.com/pypi/simple) && (pip install -i https://mirrors.aliyun.com/pypi/simple -r requirements.txt

不是吧,docker-compose.yml 是 yaml,但是 dockerfile 不是 yaml 呀

是我搞错了,不好意思,我先看看

我发现问题了,更新了回答

Related Questions