This is an old revision of the document!
Table of Contents
Dockerfile and docker-compose Filetype
Dockerfile is a file format used to build Docker images.
docker-compose.yml is a file format to build and run multiple Docker containers; using docker-compose.
Docker is a computer program that performs operating-system-level virtualization, also known as “containerization”
This page describe how to add basic Dockerfile syntax highlighting on Geany. In addition, it adds docker-compose syntax highlighting.
Step 1)
Add the following lines to ~/.config/geany/filetype_extensions.conf under the respective sections [Extensions] and [Groups]
[Extensions] Dockerfile=Dockerfile;dockerfile;*.dockerfile;*.Dockerfile;docker*; YAML= YML=*.yaml;*.yml; [Groups] Script=Dockerfile; Misc=YML;
(For the interested : it seems as the default YAML is a built-in, which cannot be removed. The workaround is to introduce the YML file type and to set 'YAML=' which overrides the file mapping. YAML file type will still be visible in the Menu, but matching of yaml files will be to YML file type.)
Step 2)
Save the configuration file below in your Geany filetype definition files config directory, e.g. ~/.config/geany/filedefs/filetypes.Dockerfile.conf
- filetypes.Dockerfile.conf
# For complete documentation of this file, please see Geany's main documentation # # Geany Color Syntax support for Dockerfiles # # version 0.2 # # 0.1 - original version # 0.2 - base on Sh instead - fixes problems with //, #, /* [styling=C] [keywords] primary= ADD ARG CMD COPY ENTRYPOINT ENV EXPOSE FROM HEALTHCHECK LABEL ONBUILD RUN SHELL STOPSIGNAL USER VOLUME WORKDIR build container_name context command default depends_on dns dockerfile entrypoint environment env_file expose external extra_hosts external_links file hostname image labels links name network ports service services volumes web devices [lexer_properties=C] [settings] lexer_filetype=Sh tag_parser=C extension= # single comments, like # in this file comment_single=# # set to false if a comment character/string should start at column 0 of a line, true uses any # indentation of the line, e.g. setting to true causes the following on pressing CTRL+d #command_example(); # setting to false would generate this # command_example(); # This setting works only for single line comments comment_use_indent=true # context action command (please see Geany's main documentation for details) context_action_cmd=xdg-open "https://docs.docker.com/engine/reference/builder/"
Step 3)
Save the configuration file below in your Geany filetype definition files config directory, e.g. ~/.config/geany/filedefs/filetypes.YML.conf
- filetypes.YML.conf
# For complete documentation of this file, please see Geany's main documentation [styling] # Edit these in the colorscheme .conf file instead default=default comment=comment identifier=identifier keyword=keyword_1 number=number_1 reference=function document=preprocessor text=string_1 error=error operator=operator [keywords] # all items must be in one line keywords= true false yes no [settings] lexer_filetype=YAML # default extension used when saving files extension=yaml # MIME type mime_type=application/x-yaml # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 # single comments, like # in this file comment_single=# # multiline comments #comment_open= #comment_close= # set to false if a comment character/string should start at column 0 of a line, true uses any # indentation of the line, e.g. setting to true causes the following on pressing CTRL+d #command_example(); # setting to false would generate this # command_example(); # This setting works only for single line comments comment_use_indent=true # context action command (please see Geany's main documentation for details) context_action_cmd= [indentation] #width=4 # 0 is spaces, 1 is tabs, 2 is tab & spaces #type=1
(For the interested : this is a copy of the default filetypes.yaml)