Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: 68 sdc lock node image version #189

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions docker/frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM node:lts-alpine3.10
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use outdated alpine

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're making custom image you need a way to push/pull it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lts version just changed and all builds are broken

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to move with skilld-labs/docker-frontend#26 cos themes are all separate and they must manage its dependencies out of sdc

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed, it's a dependency that is dependent solely on our theme(s) after fall


RUN mkdir -p /frontend/themes

ENV BASE_THEMES_PATH /frontend/themes

COPY frontend-manager /usr/bin

RUN chmod +x /usr/bin/frontend-manager
64 changes: 64 additions & 0 deletions docker/frontend/frontend-manager
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