Browse Source

chore(devx): Change scripts and Docker setup.

jackyalcine 2 months ago
parent
commit
609e36345a
Signed by: Jacky Alciné <yo@jacky.wtf> GPG Key ID: 537A4F904B15268D
4 changed files with 24 additions and 6 deletions
  1. 7
    4
      Dockerfile.dev
  2. 0
    2
      docker-compose.yml
  3. 16
    0
      docker/scripts/prepare-dev.sh
  4. 1
    0
      scripts/dev-clean.sh

+ 7
- 4
Dockerfile.dev View File

@@ -6,7 +6,8 @@ ARG MIX_ENV
6 6
 ENV MIX_ENV=${MIX_ENV:-dev} \
7 7
   TZ=Etc/UTC \
8 8
   REPLACE_OS_VARS=true \
9
-  UID=${UID:-1000}
9
+  HOST_UID=${UID:-1000} \
10
+  HOST_GID=${GID:-1000}
10 11
 
11 12
 # Inject expected root filesystem.
12 13
 COPY docker/rootfs/ /
@@ -15,10 +16,12 @@ RUN mkdir -p /opt/koype/docker/scripts
15 16
 WORKDIR /opt/koype
16 17
 
17 18
 COPY docker/rootfs /
18
-COPY docker/scripts docker/scripts
19
-
20 19
 COPY . /opt/koype/
21
-RUN sh docker/scripts/prepare.sh
20
+
21
+RUN sh docker/scripts/prepare.sh && \
22
+  sh docker/scripts/prepare-dev.sh
23
+
24
+USER koype
22 25
 
23 26
 SHELL ["/bin/bash"]
24 27
 CMD ["docker/scripts/entrypoint.sh"]

+ 0
- 2
docker-compose.yml View File

@@ -58,8 +58,6 @@ services:
58 58
       SESSION_SIGNING_SALT: ${SESSION_SIGNING_SALT}
59 59
       TEST_HOST: ${TEST_HOST}
60 60
       TEST_PORT: ${TEST_PORT}
61
-      UID: ${UID}
62
-      GID: ${GID}
63 61
     links:
64 62
       - objectstorage
65 63
     volumes:

+ 16
- 0
docker/scripts/prepare-dev.sh View File

@@ -0,0 +1,16 @@
1
+#!/usr/bin/env bash
2
+
3
+echo "[koype:user] Generating user for Koype..."
4
+adduser \
5
+  -u "${HOST_UID}" \
6
+  -D \
7
+  koype
8
+
9
+addgroup koype root
10
+addgroup koype adm
11
+
12
+echo "[koype:user] Updating file permissions..."
13
+chown koype: -R /opt/koype
14
+
15
+su koype -c "mix local.rebar --force || exit 1"
16
+su koype -c "mix local.hex --force || exit 10"

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

@@ -1,3 +1,4 @@
1 1
 #!/usr/bin/env sh
2 2
 
3
+echo "[koype:dev] Cleaning system (will require priveleges to ensure wipe)..."
3 4
 sudo rm _build deps node_modules -rf

Loading…
Cancel
Save