From ef9db12cb8ca2bac878433c661edd71f05c2a447 Mon Sep 17 00:00:00 2001 From: artie Date: Sat, 22 Feb 2025 17:52:37 +0100 Subject: [PATCH] docker deploy --- .dockerignore | 3 +++ Dockerfile | 11 +++++++++++ compose.yaml | 13 +++++++++++++ ecosystem.config.cjs | 14 -------------- src/scripts/deploy.sh | 6 +----- 5 files changed, 28 insertions(+), 19 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 compose.yaml delete mode 100644 ecosystem.config.cjs diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..8824953 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +node_modules +.git +.gitignore \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3e43503 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM oven/bun:1-alpine + +WORKDIR /app + +COPY package.json bun.lock ./ + +RUN bun install --frozen-lockfile --production + +COPY . . + +CMD ["bun", "start"] \ No newline at end of file diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..a6360dc --- /dev/null +++ b/compose.yaml @@ -0,0 +1,13 @@ +services: + app: + build: . + restart: unless-stopped + network_mode: host + logging: + driver: journald + options: + tag: artemis + volumes: + - ./data/temp:/app/data/temp + environment: + - NODE_ENV=production diff --git a/ecosystem.config.cjs b/ecosystem.config.cjs deleted file mode 100644 index e78cf57..0000000 --- a/ecosystem.config.cjs +++ /dev/null @@ -1,14 +0,0 @@ -module.exports = { - apps: [ - { - name: "artemis", - interpreter: "bun", - script: "src/index.ts", - time: true, - env: { - NODE_ENV: "production", - PATH: `${process.env.HOME}/.bun/bin:${process.env.PATH}`, - }, - }, - ], -}; diff --git a/src/scripts/deploy.sh b/src/scripts/deploy.sh index 198fef5..3adadbb 100755 --- a/src/scripts/deploy.sh +++ b/src/scripts/deploy.sh @@ -1,10 +1,6 @@ ssh lia " set -e -export PATH=\"\$HOME/.local/share/pnpm:\$PATH\" -eval \"\`\$HOME/.local/share/fnm/fnm env --shell=bash\`\" - cd artemis.js git pull -~/.bun/bin/bun install --frozen-lockfile -pm2 restart artemis +docker compose up -d --build " \ No newline at end of file