From ac2975d723a8ac5b43aadfc7ce073fc82ea74dd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Mih=C3=A1lik?= Date: Fri, 10 Nov 2023 21:11:00 +0100 Subject: [PATCH] Remote Compose (#157) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Martin Mihálik --- .github/workflows/deploy.yml | 21 +++++++++------------ Dockerfile | 9 +++++++++ compose.yaml | 8 ++++++++ 3 files changed, 26 insertions(+), 12 deletions(-) create mode 100644 Dockerfile create mode 100644 compose.yaml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 919bd947..4446fa95 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,19 +1,16 @@ name: deploy -on: - workflow_dispatch: +on: workflow_dispatch jobs: deploy: - name: "Deploy" runs-on: ubuntu-latest steps: - - name: Temporarily save SSH key to file - run: | - echo "${{ secrets.SSH_DEPLOY_KEY }}" > deploy_key - chmod 600 deploy_key - - name: Run deployment via SSH - run: ssh -o "StrictHostKeyChecking=no" -i deploy_key webstrom@server.strom.sk deploy-frontend - - - name: Clean SSH key - run: rm -f deploy_key + - uses: actions/checkout@v3 + - uses: wshihadeh/docker-deployment-action@v2 + with: + remote_docker_host: webstrom@server.strom.sk + ssh_private_key: ${{ secrets.WEBSTROM_DEPLOY_SSH_PRIVATE_KEY }} + ssh_public_key: ${{ secrets.WEBSTROM_DEPLOY_SSH_PUBLIC_KEY }} + stack_file_name: compose.yaml + args: up --build --force-recreate --detach diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..94f00da7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM node:18 + +WORKDIR /app + +COPY . ./ + +RUN yarn && yarn build + +ENTRYPOINT [ "yarn", "start", "-H", "localhost" ] diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 00000000..9f8451e7 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,8 @@ +version: "3" + +services: + frontend: + build: . + image: webstrom-frontend + network_mode: "host" + restart: always