0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-08 07:50:43 -05:00

👷 Add better naming to docker images (among other fixes).

This commit is contained in:
Andrey Antukh 2019-08-08 19:17:25 +02:00
parent 69bb359615
commit 97d74f6cf1
6 changed files with 55 additions and 51 deletions

View file

@ -16,6 +16,7 @@ services:
postgres: postgres:
image: postgres:11 image: postgres:11
restart: always restart: always
stop_signal: SIGINT
ports: ports:
- 5432:5432 - 5432:5432
environment: environment:
@ -29,7 +30,7 @@ services:
# - /etc/timezone:/etc/timezone:ro # - /etc/timezone:/etc/timezone:ro
backend: backend:
image: uxbox-backend-production:latest image: uxbox-backend:latest
restart: always restart: always
depends_on: depends_on:
- postgres - postgres
@ -49,11 +50,9 @@ services:
- UXBOX_MEDIA_DIRECTORY="data/media" - UXBOX_MEDIA_DIRECTORY="data/media"
- UXBOX_ASSETS_DIRECTORY="data/static" - UXBOX_ASSETS_DIRECTORY="data/static"
# Database setup # Database setup
- UXBOX_DATABASE_URI="jdbc:postgresql://postgres/uxbox"
- UXBOX_DATABASE_USERNAME="uxbox" - UXBOX_DATABASE_USERNAME="uxbox"
- UXBOX_DATABASE_PASSWORD="uxbox_postgres_password" - UXBOX_DATABASE_PASSWORD="uxbox_postgres_password"
- UXBOX_DATABASE_NAME="uxbox"
- UXBOX_DATABASE_SERVER="postgres"
- UXBOX_DATABASE_PORT=5432
# Mail setup # Mail setup
- UXBOX_EMAIL_REPLY_TO="no-reply@uxbox.io" - UXBOX_EMAIL_REPLY_TO="no-reply@uxbox.io"
- UXBOX_EMAIL_FROM="no-reply@uxbox.io" - UXBOX_EMAIL_FROM="no-reply@uxbox.io"
@ -69,7 +68,7 @@ services:
- UXBOX_SECRET="foobar" - UXBOX_SECRET="foobar"
frontend: frontend:
image: uxbox-frontend-production:latest image: uxbox-frontend:latest
restart: always restart: always
depends_on: depends_on:
- backend - backend
@ -81,7 +80,7 @@ services:
# - /etc/timezone:/etc/timezone:ro # - /etc/timezone:/etc/timezone:ro
frontend-dev: frontend-dev:
image: uxbox-frontend-develop:latest image: uxbox-frontend-dbg:latest
restart: always restart: always
depends_on: depends_on:
- backend - backend

View file

@ -8,6 +8,6 @@ npm ci
npx gulp dist:clean || exit 1 npx gulp dist:clean || exit 1
npx gulp dist || exit 1 npx gulp dist || exit 1
clojure -Adev tools.clj build:all || exit 1 clojure -Adev tools.clj dbg-dist:all || exit 1
npx gulp dist:gzip || exit 1 npx gulp dist:gzip || exit 1

View file

@ -13,6 +13,8 @@
;; --- Page Item ;; --- Page Item
(set! *warn-on-infer* true)
(defn use-sortable (defn use-sortable
[{:keys [type data on-hover on-drop] [{:keys [type data on-hover on-drop]
:or {on-hover (constantly nil) :or {on-hover (constantly nil)

View file

@ -74,7 +74,7 @@
(assoc-in [:modules :main :output-to] "dist/js/main.js") (assoc-in [:modules :main :output-to] "dist/js/main.js")
(assoc-in [:modules :view :output-to] "dist/js/view.js"))) (assoc-in [:modules :view :output-to] "dist/js/view.js")))
(def main-build-build-options (def main-dbg-dist-build-options
(merge main-dist-build-options (merge main-dist-build-options
{:optimizations :advanced {:optimizations :advanced
:pseudo-names true :pseudo-names true
@ -88,7 +88,7 @@
:output-dir "dist/js/worker" :output-dir "dist/js/worker"
:source-map "dist/js/worker.js.map"})) :source-map "dist/js/worker.js.map"}))
(def worker-build-build-options (def worker-dbg-dist-build-options
(merge worker-dist-build-options (merge worker-dist-build-options
{:optimizations :advanced {:optimizations :advanced
:pseudo-names true :pseudo-names true
@ -108,28 +108,30 @@
;; (pprint cfg) ;; (pprint cfg)
(api/build (api/inputs "src") cfg))) (api/build (api/inputs "src") cfg)))
(defmethod task "build:main" (defmethod task "dbg-dist:main"
[args] [args]
(let [cfg main-build-build-options] (let [cfg main-dbg-dist-build-options]
;; (pprint cfg) ;; (pprint cfg)
(api/build (api/inputs "src") cfg))) (api/build (api/inputs "src") cfg)))
(defmethod task "build:worker" (defmethod task "dbg-dist:worker"
[args] [args]
(let [cfg worker-build-build-options] (let [cfg worker-dbg-dist-build-options]
;; (pprint cfg) ;; (pprint cfg)
(api/build (api/inputs "src") cfg))) (api/build (api/inputs "src") cfg)))
(defmethod task "build:all"
[args]
(task ["build:main"])
(task ["build:worker"]))
(defmethod task "dist:all" (defmethod task "dist:all"
[args] [args]
(task ["dist:main"]) (task ["dist:main"])
(task ["dist:worker"])) (task ["dist:worker"]))
(defmethod task "dbg-dist:all"
[args]
(task ["dbg-dist:main"])
(task ["dbg-dist:worker"]))
;; --- Tests Tasks ;; --- Tests Tasks

View file

@ -103,27 +103,27 @@ function build-frontend-local {
$CONTAINER ./scripts/build-$BUILD_TYPE.sh $CONTAINER ./scripts/build-$BUILD_TYPE.sh
} }
function build-frontend-production-image { function build-frontend-image {
build-frontend-local "production" || exit 1; build-frontend-local "dist" || exit 1;
rm -rf docker/frontend/dist || exit 1; rm -rf docker/frontend/dist || exit 1;
cp -vr frontend/dist docker/frontend/ || exit 1; cp -vr frontend/dist docker/frontend/ || exit 1;
docker build --rm=true \ docker build --rm=true \
-t uxbox-frontend-production:$REV \ -t uxbox-frontend:$REV \
-t uxbox-frontend-production:latest \ -t uxbox-frontend:latest \
docker/frontend/; docker/frontend/;
rm -rf docker/frontend/dist || exit 1; rm -rf docker/frontend/dist || exit 1;
} }
function build-frontend-develop-image { function build-frontend-dbg-image {
build-frontend-local "develop" || exit 1; build-frontend-local "dbg-dist" || exit 1;
rm -rf docker/frontend/dist || exit 1; rm -rf docker/frontend/dist || exit 1;
cp -vr frontend/dist docker/frontend/ || exit 1; cp -vr frontend/dist docker/frontend/ || exit 1;
docker build --rm=true \ docker build --rm=true \
-t uxbox-frontend-develop:$REV \ -t uxbox-frontend-dbg:$REV \
-t uxbox-frontend-develop:latest \ -t uxbox-frontend-dbg:latest \
docker/frontend/; docker/frontend/;
rm -rf docker/frontend/dist || exit 1; rm -rf docker/frontend/dist || exit 1;
@ -143,42 +143,42 @@ function build-backend-local {
./backend/ ./backend/dist/ ./backend/ ./backend/dist/
} }
function build-backend-production-image { function build-backend-image {
build-backend-local || exit 1; build-backend-local || exit 1;
rm -rf docker/backend/dist || exit 1; rm -rf docker/backend/dist || exit 1;
cp -vr backend/dist docker/backend/ || exit 1; cp -vr backend/dist docker/backend/ || exit 1;
docker build --rm=true \ docker build --rm=true \
-t uxbox-backend-production:$REV \ -t uxbox-backend:$REV \
-t uxbox-backend-production:latest \ -t uxbox-backend:latest \
docker/backend/; docker/backend/;
rm -rf docker/backend/dist || exit 1; rm -rf docker/backend/dist || exit 1;
} }
function build-images { function build-images {
echo "Building frontend production image ..." echo "Building frontend image ..."
build-frontend-production-image || exit 1; build-frontend-image || exit 1;
echo "Building frontend develop image ..." echo "Building frontend dbg image ..."
build-frontend-develop-image || exit 1; build-frontend-dbg-image || exit 1;
echo "Building backend production image ..." echo "Building backend image ..."
build-backend-production-image || exit 1; build-backend-image || exit 1;
} }
function run { function run {
if [[ ! $(docker images uxbox-backend-production:latest) ]]; then if [[ ! $(docker images uxbox-backend:latest) ]]; then
build-production-backend-image build-backend-image
fi fi
if [[ ! $(docker images uxbox-frontend-production:latest) ]]; then if [[ ! $(docker images uxbox-frontend:latest) ]]; then
build-production-frontend-image build-frontend-image
fi fi
if [[ ! $(docker images uxbox-frontend-develop:latest) ]]; then if [[ ! $(docker images uxbox-frontend-dbg:latest) ]]; then
build-develop-frontend-image build-frontend-dbg-image
fi fi
echo "Running production images..." echo "Running images..."
docker-compose -p uxbox -f ./docker/docker-compose.yml up -d docker-compose -p uxbox -f ./docker/docker-compose.yml up -d
} }
@ -202,9 +202,10 @@ function usage {
echo "- run-frontend-tests Execute unit tests for frontend only" echo "- run-frontend-tests Execute unit tests for frontend only"
echo "- run-backend-tests Execute unit tests for backend only" echo "- run-backend-tests Execute unit tests for backend only"
echo "- build-images Build a 'release ready' docker images for both backend and frontend" echo "- build-images Build a 'release ready' docker images for both backend and frontend"
echo "- build-frontend-develop-image Build a 'release ready' docker image for frontend (develop build)" echo "- build-frontend-image Build a 'release ready' docker image for frontend (debug version)"
echo "- build-frontend-production-image Build a 'release ready' docker images for frontend" echo "- build-frontend-dbg-image Build a 'release ready' docker images for frontend"
echo "- build-backend-production-image Build a 'release ready' docker images for backend" echo "- build-backend-image Build a 'release ready' docker images for backend"
echo "- log Attach to docker logs."
echo "- run Run 'production ready' docker compose" echo "- run Run 'production ready' docker compose"
echo "- stop Stop 'production ready' docker compose" echo "- stop Stop 'production ready' docker compose"
} }
@ -233,14 +234,14 @@ case $1 in
build-images) build-images)
build-images build-images
;; ;;
build-frontend-develop-image) build-frontend-dbg-image)
build-frontend-develop-image; build-frontend-dbg-image;
;; ;;
build-frontend-production-image) build-frontend-image)
build-frontend-production-image; build-frontend-image;
;; ;;
build-backend-production-image) build-backend-image)
build-backend-production-image; build-backend-image;
;; ;;
run) run)