-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
173 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* Highlighter | ||
* | ||
* Copyright (C) 2016, Some right reserved. | ||
* | ||
* @author Kacper "Kadet" Donat <[email protected]> | ||
* | ||
* Contact with author: | ||
* Xmpp: [email protected] | ||
* E-mail: [email protected] | ||
* | ||
* From Kadet with love. | ||
*/ | ||
|
||
namespace Kadet\Highlighter\Language; | ||
|
||
use Kadet\Highlighter\Matcher\RegexMatcher; | ||
use Kadet\Highlighter\Parser\Rule; | ||
|
||
class Dockerfile extends Shell | ||
{ | ||
public function setupRules() | ||
{ | ||
parent::setupRules(); | ||
|
||
$keywords = [ | ||
'ADD', 'ARG', 'AS', 'CMD', 'COPY', 'ENTRYPOINT', 'ENV', 'EXPOSE', 'FROM', | ||
'HEALTHCHECK', 'LABEL', 'MAINTAINER', 'ONBUILD', 'RUN', 'SHELL', 'STOPSIGNAL', | ||
'USER', 'VOLUME', 'WORKDIR', | ||
]; | ||
|
||
$this->rules->add('keyword', new Rule( | ||
new RegexMatcher('/^\s*\b(' . implode('|', $keywords) . ')\b/mi'), | ||
['priority' => 2] | ||
)); | ||
} | ||
|
||
/** | ||
* Unique language identifier, for example 'php' | ||
* | ||
* @return string | ||
*/ | ||
public function getIdentifier() | ||
{ | ||
return 'dockerfile'; | ||
} | ||
|
||
public static function getMetadata() | ||
{ | ||
return [ | ||
'name' => ['dockerfile'], | ||
'extension' => ['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,33 @@ | ||
{language.dockerfile:Kadet\Highlighter\Parser\Token\LanguageToken}{keyword:Kadet\Highlighter\Parser\Token\Token}FROM{/keyword:Kadet\Highlighter\Parser\Token\Token} node:{number:Kadet\Highlighter\Parser\Token\Token}18{/number:Kadet\Highlighter\Parser\Token\Token}-alpine | ||
|
||
{keyword:Kadet\Highlighter\Parser\Token\Token}WORKDIR{/keyword:Kadet\Highlighter\Parser\Token\Token} /app | ||
|
||
{comment:Kadet\Highlighter\Parser\Token\Token}# Install dependencies based on the preferred package manager{/comment:Kadet\Highlighter\Parser\Token\Token} | ||
{keyword:Kadet\Highlighter\Parser\Token\Token}COPY{/keyword:Kadet\Highlighter\Parser\Token\Token} package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./ | ||
{keyword:Kadet\Highlighter\Parser\Token\Token}RUN{/keyword:Kadet\Highlighter\Parser\Token\Token} \ | ||
{keyword:Kadet\Highlighter\Parser\Token\Token}if{/keyword:Kadet\Highlighter\Parser\Token\Token} [ {symbol.parameter:Kadet\Highlighter\Parser\Token\Token}-f{/symbol.parameter:Kadet\Highlighter\Parser\Token\Token} yarn.lock ]; {keyword:Kadet\Highlighter\Parser\Token\Token}then{/keyword:Kadet\Highlighter\Parser\Token\Token} {call:Kadet\Highlighter\Parser\Token\Token}yarn{/call:Kadet\Highlighter\Parser\Token\Token} {symbol.parameter:Kadet\Highlighter\Parser\Token\Token}--frozen-lockfile{/symbol.parameter:Kadet\Highlighter\Parser\Token\Token}; \ | ||
{keyword:Kadet\Highlighter\Parser\Token\Token}elif{/keyword:Kadet\Highlighter\Parser\Token\Token} [ {symbol.parameter:Kadet\Highlighter\Parser\Token\Token}-f{/symbol.parameter:Kadet\Highlighter\Parser\Token\Token} package-lock.json ]; {keyword:Kadet\Highlighter\Parser\Token\Token}then{/keyword:Kadet\Highlighter\Parser\Token\Token} {call:Kadet\Highlighter\Parser\Token\Token}npm{/call:Kadet\Highlighter\Parser\Token\Token} ci; \ | ||
{keyword:Kadet\Highlighter\Parser\Token\Token}elif{/keyword:Kadet\Highlighter\Parser\Token\Token} [ {symbol.parameter:Kadet\Highlighter\Parser\Token\Token}-f{/symbol.parameter:Kadet\Highlighter\Parser\Token\Token} pnpm-lock.yaml ]; {keyword:Kadet\Highlighter\Parser\Token\Token}then{/keyword:Kadet\Highlighter\Parser\Token\Token} {call:Kadet\Highlighter\Parser\Token\Token}corepack{/call:Kadet\Highlighter\Parser\Token\Token} enable pnpm && pnpm i; \ | ||
{comment:Kadet\Highlighter\Parser\Token\Token}# Allow install without lockfile, so example works even without Node.js installed locally{/comment:Kadet\Highlighter\Parser\Token\Token} | ||
{keyword:Kadet\Highlighter\Parser\Token\Token}else{/keyword:Kadet\Highlighter\Parser\Token\Token} {call:Kadet\Highlighter\Parser\Token\Token}echo{/call:Kadet\Highlighter\Parser\Token\Token} {string.double:Kadet\Highlighter\Parser\Token\ContextualToken}"Warning: Lockfile not found. It is recommended to commit lockfiles to version control."{/string.double:Kadet\Highlighter\Parser\Token\ContextualToken} && yarn install; \ | ||
{keyword:Kadet\Highlighter\Parser\Token\Token}fi{/keyword:Kadet\Highlighter\Parser\Token\Token} | ||
|
||
{keyword:Kadet\Highlighter\Parser\Token\Token}COPY{/keyword:Kadet\Highlighter\Parser\Token\Token} src ./src | ||
{keyword:Kadet\Highlighter\Parser\Token\Token}COPY{/keyword:Kadet\Highlighter\Parser\Token\Token} public ./public | ||
{keyword:Kadet\Highlighter\Parser\Token\Token}COPY{/keyword:Kadet\Highlighter\Parser\Token\Token} next.config.js . | ||
{keyword:Kadet\Highlighter\Parser\Token\Token}COPY{/keyword:Kadet\Highlighter\Parser\Token\Token} tsconfig.json . | ||
|
||
{comment:Kadet\Highlighter\Parser\Token\Token}# Next.js collects completely anonymous telemetry data about general usage. Learn more here: https://nextjs.org/telemetry{/comment:Kadet\Highlighter\Parser\Token\Token} | ||
{comment:Kadet\Highlighter\Parser\Token\Token}# Uncomment the following line to disable telemetry at run time{/comment:Kadet\Highlighter\Parser\Token\Token} | ||
{keyword:Kadet\Highlighter\Parser\Token\Token}ENV{/keyword:Kadet\Highlighter\Parser\Token\Token} NEXT_TELEMETRY_DISABLED {number:Kadet\Highlighter\Parser\Token\Token}1{/number:Kadet\Highlighter\Parser\Token\Token} | ||
|
||
{comment:Kadet\Highlighter\Parser\Token\Token}# Note: Don't expose ports here, Compose will handle that for us{/comment:Kadet\Highlighter\Parser\Token\Token} | ||
|
||
{comment:Kadet\Highlighter\Parser\Token\Token}# Start Next.js in development mode based on the preferred package manager{/comment:Kadet\Highlighter\Parser\Token\Token} | ||
{keyword:Kadet\Highlighter\Parser\Token\Token}CMD{/keyword:Kadet\Highlighter\Parser\Token\Token} \ | ||
{keyword:Kadet\Highlighter\Parser\Token\Token}if{/keyword:Kadet\Highlighter\Parser\Token\Token} [ {symbol.parameter:Kadet\Highlighter\Parser\Token\Token}-f{/symbol.parameter:Kadet\Highlighter\Parser\Token\Token} yarn.lock ]; {keyword:Kadet\Highlighter\Parser\Token\Token}then{/keyword:Kadet\Highlighter\Parser\Token\Token} {call:Kadet\Highlighter\Parser\Token\Token}yarn{/call:Kadet\Highlighter\Parser\Token\Token} dev; \ | ||
{keyword:Kadet\Highlighter\Parser\Token\Token}elif{/keyword:Kadet\Highlighter\Parser\Token\Token} [ {symbol.parameter:Kadet\Highlighter\Parser\Token\Token}-f{/symbol.parameter:Kadet\Highlighter\Parser\Token\Token} package-lock.json ]; {keyword:Kadet\Highlighter\Parser\Token\Token}then{/keyword:Kadet\Highlighter\Parser\Token\Token} {call:Kadet\Highlighter\Parser\Token\Token}npm{/call:Kadet\Highlighter\Parser\Token\Token} run dev; \ | ||
{keyword:Kadet\Highlighter\Parser\Token\Token}elif{/keyword:Kadet\Highlighter\Parser\Token\Token} [ {symbol.parameter:Kadet\Highlighter\Parser\Token\Token}-f{/symbol.parameter:Kadet\Highlighter\Parser\Token\Token} pnpm-lock.yaml ]; {keyword:Kadet\Highlighter\Parser\Token\Token}then{/keyword:Kadet\Highlighter\Parser\Token\Token} {call:Kadet\Highlighter\Parser\Token\Token}pnpm{/call:Kadet\Highlighter\Parser\Token\Token} dev; \ | ||
{keyword:Kadet\Highlighter\Parser\Token\Token}else{/keyword:Kadet\Highlighter\Parser\Token\Token} {call:Kadet\Highlighter\Parser\Token\Token}npm{/call:Kadet\Highlighter\Parser\Token\Token} run dev; \ | ||
{keyword:Kadet\Highlighter\Parser\Token\Token}fi{/keyword:Kadet\Highlighter\Parser\Token\Token} | ||
{/language.dockerfile:Kadet\Highlighter\Parser\Token\LanguageToken} |
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,32 @@ | ||
FROM node:18-alpine | ||
|
||
WORKDIR /app | ||
|
||
# Install dependencies based on the preferred package manager | ||
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./ | ||
RUN \ | ||
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \ | ||
elif [ -f package-lock.json ]; then npm ci; \ | ||
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i; \ | ||
# Allow install without lockfile, so example works even without Node.js installed locally | ||
else echo "Warning: Lockfile not found. It is recommended to commit lockfiles to version control." && yarn install; \ | ||
fi | ||
|
||
COPY src ./src | ||
COPY public ./public | ||
COPY next.config.js . | ||
COPY tsconfig.json . | ||
|
||
# Next.js collects completely anonymous telemetry data about general usage. Learn more here: https://nextjs.org/telemetry | ||
# Uncomment the following line to disable telemetry at run time | ||
ENV NEXT_TELEMETRY_DISABLED 1 | ||
|
||
# Note: Don't expose ports here, Compose will handle that for us | ||
|
||
# Start Next.js in development mode based on the preferred package manager | ||
CMD \ | ||
if [ -f yarn.lock ]; then yarn dev; \ | ||
elif [ -f package-lock.json ]; then npm run dev; \ | ||
elif [ -f pnpm-lock.yaml ]; then pnpm dev; \ | ||
else npm run dev; \ | ||
fi |
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