diff --git a/ansible/deploy.yml b/ansible/deploy.yml index 19b848b..9b4626a 100644 --- a/ansible/deploy.yml +++ b/ansible/deploy.yml @@ -28,13 +28,54 @@ owner: "{{ app_user }}" group: "{{ app_user }}" - - name: Copy binary to target location - copy: - src: ../target/sepiatones_xyz - dest: "{{ app_home }}/sepiatones_xyz" + - name: Install Bun + shell: curl -fsSL https://bun.sh/install | bash + args: + creates: /home/{{ app_user }}/.bun/bin/bun + become_user: "{{ app_user }}" + + - name: Create source directory + file: + path: "{{ app_home }}/src" + state: directory owner: "{{ app_user }}" group: "{{ app_user }}" - mode: "0755" + + - name: Copy package.json + copy: + src: ../package.json + dest: "{{ app_home }}/package.json" + owner: "{{ app_user }}" + group: "{{ app_user }}" + + - name: Copy bun.lockb + copy: + src: ../bun.lockb + dest: "{{ app_home }}/bun.lockb" + owner: "{{ app_user }}" + group: "{{ app_user }}" + + - name: Copy source files + synchronize: + src: ../src/ + dest: "{{ app_home }}/src/" + recursive: yes + owner: no + group: no + archive: yes + delete: yes + + - name: Install dependencies + shell: /home/{{ app_user }}/.bun/bin/bun install --frozen-lockfile + args: + chdir: "{{ app_home }}" + become_user: "{{ app_user }}" + + - name: Build binary + shell: /home/{{ app_user }}/.bun/bin/bun build --compile --minify --target bun --outfile ./sepiatones_xyz ./src/index.tsx + args: + chdir: "{{ app_home }}" + become_user: "{{ app_user }}" - name: Copy data directory synchronize: diff --git a/bun.lockb b/bun.lockb old mode 100644 new mode 100755 index 8cd5f52..65b9760 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/justfile b/justfile index 9c24bd9..531b930 100644 --- a/justfile +++ b/justfile @@ -7,7 +7,7 @@ dev: build: bun build --compile --minify --target bun --outfile ./target/sepiatones_xyz ./src/index.tsx -deploy: build +deploy: ansible-playbook -i ansible/hosts.ini ansible/deploy.yml test: