forked from skilld-labs/skilld-docker-container
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SDC - Lock Node image version - skilld-labs#68.
- Loading branch information
Showing
2 changed files
with
73 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM node:lts-alpine3.10 | ||
|
||
RUN mkdir -p /frontend/themes | ||
|
||
ENV BASE_THEMES_PATH /frontend/themes | ||
|
||
COPY frontend-manager /usr/bin | ||
|
||
RUN chmod +x /usr/bin/frontend-manager |
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,64 @@ | ||
#!/bin/sh | ||
|
||
##### | ||
##### Frontend image for Skilld. | ||
##### | ||
##### This image supports multiple theme folders. | ||
##### To make available a theme, just place it as volume into the path "/frontend/themes" inside container. Example: /frontend/themes/my_theme. | ||
##### | ||
|
||
##### Let's define useful functions. | ||
function front_build { | ||
cd $BASE_THEMES_PATH | ||
for THEME_FOLDER in */ ; do | ||
if [ -e $BASE_THEMES_PATH/$THEME_FOLDER/package.json ] | ||
then | ||
echo "Building front tasks in folder \"$THEME_FOLDER\"..." | ||
cd "$BASE_THEMES_PATH/$THEME_FOLDER" | ||
yarn install --prod --ignore-optional --check-files | ||
yarn build --verbose | ||
else | ||
echo "Folder \"$THEME_FOLDER\" doesn't contain a \"package.json\" file. Skip." | ||
fi | ||
done | ||
} | ||
|
||
function front_lint { | ||
cd $BASE_THEMES_PATH | ||
for THEME_FOLDER in */ ; do | ||
if [ -e $BASE_THEMES_PATH/$THEME_FOLDER/package.json ] | ||
then | ||
echo "Executing linters in folder \"$THEME_FOLDER\"..." | ||
cd "$BASE_THEMES_PATH/$THEME_FOLDER" | ||
yarn install --prod --ignore-optional --check-files | ||
yarn lint-fix | ||
else | ||
echo "Folder \"$THEME_FOLDER\" doesn't contain a \"package.json\" file. Skip." | ||
fi | ||
done | ||
} | ||
|
||
function front_clear { | ||
cd $BASE_THEMES_PATH | ||
for THEME_FOLDER in */ ; do | ||
echo "Clearing folder $THEME_FOLDER..." | ||
rm -rf "$THEME_FOLDER/node_modules" | ||
rm -rf "$THEME_FOLDER/dist" | ||
done | ||
} | ||
|
||
##### Let's process requested option. | ||
case $1 in | ||
"build") | ||
front_build | ||
;; | ||
"lint") | ||
front_lint | ||
;; | ||
"clear") | ||
front_clear | ||
;; | ||
*) | ||
echo "Invalid option \"$1\". Skip." | ||
;; | ||
esac |