Skip to content

Commit

Permalink
switch to docker (try)
Browse files Browse the repository at this point in the history
  • Loading branch information
d4vss committed Sep 16, 2024
1 parent 9f92f15 commit 0f36c90
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
npm-debug.log
Dockerfile
.dockerignore
.git
.gitignore
42 changes: 42 additions & 0 deletions .github/workflows/docker-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Build and Deploy App

on:
push:
branches:
- main

jobs:
build-project:
name: Build project
runs-on: self-hosted
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Create .env file
run: |
echo "AUTH_SECRET=${{ secrets.AUTH_SECRET }}" > .env
echo "XATA_BRANCH=${{ secrets.XATA_BRANCH }}" >> .env
echo "XATA_API_KEY=${{ secrets.XATA_API_KEY }}" >> .env
echo "AUTH_DISCORD_ID=${{ secrets.AUTH_DISCORD_ID }}" >> .env
echo "AUTH_DISCORD_SECRET=${{ secrets.AUTH_DISCORD_SECRET }}" >> .env
echo "CUSTOM_DISCORD_WEBHOOK_URL=${{ secrets.CUSTOM_DISCORD_WEBHOOK_URL }}" >> .env
echo "AUTH_TRUST_HOST=TRUE" >> .env
- name: Build Docker image
run: |
docker build -t forzamods-dev .
- name: Deploy Docker container
if: success()
run: |
docker stop forzamods-dev || true
docker rm forzamods-dev || true
docker run -d -p 3271:3000 \
--name forzamods-dev \
--env-file .env \
forzamods-dev
- name: Cleanup
run: |
rm .env
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM node:20
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm install
COPY . .
RUN npm run build
EXPOSE 3271

CMD ["npm", "start"]

0 comments on commit 0f36c90

Please sign in to comment.