Browse Source

chore(app): Tweaks for local Docker dev.

jackyalcine 2 months ago
parent
commit
fa85390e95
Signed by: Jacky Alciné <yo@jacky.wtf> GPG Key ID: 537A4F904B15268D
9 changed files with 25 additions and 19 deletions
  1. 3
    0
      .drone.yml
  2. 3
    3
      Dockerfile.dev
  3. 2
    2
      app.json
  4. 3
    4
      docker/scripts/build.sh
  5. 3
    0
      docker/scripts/prepare.sh
  6. 1
    1
      package-lock.json
  7. 1
    1
      package.json
  8. 3
    0
      scripts/dev-clean.sh
  9. 6
    8
      scripts/dev-setup.sh

+ 3
- 0
.drone.yml View File

@@ -22,6 +22,9 @@ steps:
22 22
     - mc policy set download test/koype-test/images
23 23
     - mc policy set download test/koype-test/videos
24 24
     - mc policy set download test/koype-test/audio
25
+  when:
26
+    event:
27
+      - push
25 28
 
26 29
 - name: run tests
27 30
   image: elixir:1.7.4-alpine

+ 3
- 3
Dockerfile.dev View File

@@ -8,17 +8,17 @@ ENV MIX_ENV=${MIX_ENV:-dev} \
8 8
   REPLACE_OS_VARS=true \
9 9
   UID=${UID:-1000}
10 10
 
11
+# Inject expected root filesystem.
11 12
 COPY docker/rootfs/ /
12 13
 
13 14
 RUN mkdir -p /opt/koype/docker/scripts
14 15
 WORKDIR /opt/koype
16
+
15 17
 COPY docker/rootfs /
16 18
 COPY docker/scripts docker/scripts
17 19
 
18
-RUN sh docker/scripts/prepare.sh
19 20
 COPY . /opt/koype/
20
-
21
-RUN sh docker/scripts/build.sh
21
+RUN sh docker/scripts/prepare.sh
22 22
 
23 23
 SHELL ["/bin/bash"]
24 24
 CMD ["docker/scripts/entrypoint.sh"]

+ 2
- 2
app.json View File

@@ -1,8 +1,8 @@
1 1
 {
2 2
   "scripts": {
3 3
     "dokku": {
4
-      "predeploy": "bash docker/scripts/pre-deploy.sh",
5
-      "postdeploy": "bash docker/scripts/post-deploy.sh"
4
+      "predeploy": "docker/scripts/pre-deploy.sh",
5
+      "postdeploy": "docker/scripts/post-deploy.sh"
6 6
     }
7 7
   },
8 8
   "name": "Koype",

+ 3
- 4
docker/scripts/build.sh View File

@@ -3,9 +3,8 @@
3 3
 export HEX_HTTP_CONCURRENCY=10
4 4
 export HEX_HTTP_TIMEOUT=600
5 5
 
6
-echo " ---> [mix] Preparing..."
7
-mix local.hex --force || exit 10
8
-mix local.rebar --force || exit 11
9
-
10 6
 echo " ---> [mix] Fetching dependencies..."
11 7
 mix deps.get || exit 12
8
+
9
+echo " ---> [npm] Fetching dependencies..."
10
+npm install || exit 13

+ 3
- 0
docker/scripts/prepare.sh View File

@@ -31,3 +31,6 @@ apk add -U --virtual=build \
31 31
   || exit 30
32 32
 
33 33
 mkdir -p /opt/koype
34
+
35
+mix local.rebar --force || exit 1
36
+mix local.hex --force || exit 10

+ 1
- 1
package-lock.json View File

@@ -1,6 +1,6 @@
1 1
 {
2 2
   "name": "koype",
3
-  "version": "0.0.12",
3
+  "version": "0.0.17",
4 4
   "lockfileVersion": 1,
5 5
   "requires": true,
6 6
   "dependencies": {

+ 1
- 1
package.json View File

@@ -53,7 +53,7 @@
53 53
     "webfontloader": "1.6.28"
54 54
   },
55 55
   "engines": {
56
-    "node": "~> 10.14.0"
56
+    "node": "~> 10"
57 57
   },
58 58
   "devDependencies": {
59 59
     "@types/autoprefixer": "9.4.0",

+ 3
- 0
scripts/dev-clean.sh View File

@@ -0,0 +1,3 @@
1
+#!/usr/bin/env sh
2
+
3
+sudo rm _build deps node_modules -rf

+ 6
- 8
scripts/dev-setup.sh View File

@@ -2,19 +2,17 @@
2 2
 
3 3
 export MIX_ENV=dev
4 4
 
5
-touch priv/repo/db/dev.db
6
-npm clean
7
-
8 5
 docker-compose up --build -d
9 6
 
10 7
 docker-compose run mc mb koype/koype-dev --region local
11 8
 
12
-echo " ---> [koype:dev] Emulating post-deploy steps..."
13
-docker-compose run --rm site mix do deps.get, deps.compile, compile
9
+echo " ---> [koype:dev] Fetching dependencies and rebuilding natively within..."
10
+mix do deps.get
11
+docker-compose run --rm site mix compile
14 12
 
15 13
 echo " ---> [koype:dev] Running needed post-build steps..."
16
-docker-compose run --rm site npm install --link false
17
-docker-compose run --rm site npm rebuild node-sass
18
-docker-compose run --rm site mix ecto.setup
14
+npm install --link false
15
+docker-compose run --rm site npm rebuild
19 16
 
17
+docker-compose run --rm site mix ecto.setup
20 18
 docker-compose restart -t 0 site

Loading…
Cancel
Save