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

View file

@ -8,6 +8,6 @@ npm ci
npx gulp dist:clean || 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

View file

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

View file

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

View file

@ -103,27 +103,27 @@ function build-frontend-local {
$CONTAINER ./scripts/build-$BUILD_TYPE.sh
}
function build-frontend-production-image {
build-frontend-local "production" || exit 1;
function build-frontend-image {
build-frontend-local "dist" || exit 1;
rm -rf docker/frontend/dist || exit 1;
cp -vr frontend/dist docker/frontend/ || exit 1;
docker build --rm=true \
-t uxbox-frontend-production:$REV \
-t uxbox-frontend-production:latest \
-t uxbox-frontend:$REV \
-t uxbox-frontend:latest \
docker/frontend/;
rm -rf docker/frontend/dist || exit 1;
}
function build-frontend-develop-image {
build-frontend-local "develop" || exit 1;
function build-frontend-dbg-image {
build-frontend-local "dbg-dist" || exit 1;
rm -rf docker/frontend/dist || exit 1;
cp -vr frontend/dist docker/frontend/ || exit 1;
docker build --rm=true \
-t uxbox-frontend-develop:$REV \
-t uxbox-frontend-develop:latest \
-t uxbox-frontend-dbg:$REV \
-t uxbox-frontend-dbg:latest \
docker/frontend/;
rm -rf docker/frontend/dist || exit 1;
@ -143,42 +143,42 @@ function build-backend-local {
./backend/ ./backend/dist/
}
function build-backend-production-image {
function build-backend-image {
build-backend-local || exit 1;
rm -rf docker/backend/dist || exit 1;
cp -vr backend/dist docker/backend/ || exit 1;
docker build --rm=true \
-t uxbox-backend-production:$REV \
-t uxbox-backend-production:latest \
-t uxbox-backend:$REV \
-t uxbox-backend:latest \
docker/backend/;
rm -rf docker/backend/dist || exit 1;
}
function build-images {
echo "Building frontend production image ..."
build-frontend-production-image || exit 1;
echo "Building frontend develop image ..."
build-frontend-develop-image || exit 1;
echo "Building backend production image ..."
build-backend-production-image || exit 1;
echo "Building frontend image ..."
build-frontend-image || exit 1;
echo "Building frontend dbg image ..."
build-frontend-dbg-image || exit 1;
echo "Building backend image ..."
build-backend-image || exit 1;
}
function run {
if [[ ! $(docker images uxbox-backend-production:latest) ]]; then
build-production-backend-image
if [[ ! $(docker images uxbox-backend:latest) ]]; then
build-backend-image
fi
if [[ ! $(docker images uxbox-frontend-production:latest) ]]; then
build-production-frontend-image
if [[ ! $(docker images uxbox-frontend:latest) ]]; then
build-frontend-image
fi
if [[ ! $(docker images uxbox-frontend-develop:latest) ]]; then
build-develop-frontend-image
if [[ ! $(docker images uxbox-frontend-dbg:latest) ]]; then
build-frontend-dbg-image
fi
echo "Running production images..."
echo "Running images..."
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-backend-tests Execute unit tests for backend only"
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-production-image Build a 'release ready' docker images for frontend"
echo "- build-backend-production-image Build a 'release ready' docker images for backend"
echo "- build-frontend-image Build a 'release ready' docker image for frontend (debug version)"
echo "- build-frontend-dbg-image Build a 'release ready' docker images for frontend"
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 "- stop Stop 'production ready' docker compose"
}
@ -233,14 +234,14 @@ case $1 in
build-images)
build-images
;;
build-frontend-develop-image)
build-frontend-develop-image;
build-frontend-dbg-image)
build-frontend-dbg-image;
;;
build-frontend-production-image)
build-frontend-production-image;
build-frontend-image)
build-frontend-image;
;;
build-backend-production-image)
build-backend-production-image;
build-backend-image)
build-backend-image;
;;
run)