Skip to content

Commit

Permalink
updated three by one
Browse files Browse the repository at this point in the history
  • Loading branch information
geoffreysmith committed May 12, 2022
1 parent 9e2d2c7 commit 30ee8bb
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 20 deletions.
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ PORT=1337
# DOCKER TASKS
# Build the container
build: ## Build the container
docker build -t $(APP_NAME) .
docker build --pull --rm -f "assets/Dockerfile" -t $(APP_NAME):latest "assets"

build-nc: ## Build the container without caching
docker build --no-cache -t $(APP_NAME) .
docker build --no-cache -t $(APP_NAME) ./assets/

run:
docker run -i -t --rm -p=$(PORT):$(PORT) --name="$(APP_NAME)" $(APP_NAME)
docker run -i -t --rm -p=$(PORT):$(PORT) -v=${PWD}/app:/srv/app --name="$(APP_NAME)" dopomoha

inspect:
docker exec -it ${APP_NAME} sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"collectionName": "components_section_three_by_one_ctas",
"collectionName": "components_layout_three_by_one_ctas",
"info": {
"displayName": "Three By One CTA",
"icon": "atom"
Expand Down
18 changes: 18 additions & 0 deletions assets/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# BASE
ARG NODE_VERSION=14
FROM node:${NODE_VERSION}-alpine AS base-alpine
EXPOSE 1337

FROM base-alpine

RUN apt-get update && apt-get install libvips-dev

RUN apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev nasm bash

RUN mkdir -p /srv/app && chown 1000:1000 -R /srv/app

WORKDIR /srv/app

VOLUME /srv/app

CMD ["sh"]
20 changes: 4 additions & 16 deletions assets/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,18 @@ if [ "$*" = "strapi" ]; then

if [ ! -f "package.json" ]; then

DATABASE_CLIENT=${DATABASE_CLIENT:-sqlite}

EXTRA_ARGS=${EXTRA_ARGS}

echo "Using strapi $(strapi version)"
echo "No project found at /srv/app. Creating a new strapi project ..."

DOCKER=true strapi new . --no-run \
--dbclient=$DATABASE_CLIENT \
--dbhost=$DATABASE_HOST \
--dbport=$DATABASE_PORT \
--dbname=$DATABASE_NAME \
--dbusername=$DATABASE_USERNAME \
--dbpassword=$DATABASE_PASSWORD \
--dbssl=$DATABASE_SSL \
--ts \
$EXTRA_ARGS
#DOCKER=true yarn create strapi-app@beta app \
# --typescript \

elif [ ! -d "node_modules" ] || [ ! "$(ls -qAL node_modules 2>/dev/null)" ]; then

if [ -f "yarn.lock" ]; then

echo "Node modules not installed. Installing using yarn ..."
yarn install --prod --silent
#yarn install --prod --silent

else

Expand All @@ -46,7 +34,7 @@ if [ "$*" = "strapi" ]; then
fi

echo "Starting your app (with ${STRAPI_MODE:-develop})..."
exec strapi "${STRAPI_MODE:-develop}"
#exec strapi "${STRAPI_MODE:-develop}"

else
exec "$@"
Expand Down
8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: '3'
services:
strapi:
image: dopomoha
ports:
- '1337:1337'
volumes:
- ./app:/srv/app # to use an existing project or create a new project inside the folder ./app

0 comments on commit 30ee8bb

Please sign in to comment.