Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Build image

on:
push:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
push: ${{ github.event_name != 'pull_request' && github.ref_name == 'main' && vars.DEPLOY == 'y' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
deploy:
runs-on: ubuntu-latest
needs: [build]
if: ${{ github.event_name != 'pull_request' && github.ref_name == 'main' }}
steps:
- name: Deploy to server
if: ${{ vars.DEPLOY == 'y' }}
run: |
curl -H "Authorization: Bearer ${DEPLOY_API_TOKEN}" ${DEPLOY_API_ENDPOINT}
env:
DEPLOY_API_ENDPOINT: ${{ secrets.DEPLOY_API_ENDPOINT }}
DEPLOY_API_TOKEN: ${{ secrets.DEPLOY_API_TOKEN }}
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM node:lts-slim

COPY . /src

WORKDIR /src/server

RUN npm run build

CMD ["node", "server.js"]
2 changes: 1 addition & 1 deletion server/app/config/auth.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
secret: "bezkoder-secret-key"
secret: process.env.AUTH_SECRET || "bezkoder-secret-key"
};
2 changes: 1 addition & 1 deletion server/app/config/db.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
// url: "mongodb+srv://MAPF:MONASH@mapfbenchmark.zsijqdc.mongodb.net/MAPF_test?retryWrites=true&w=majority"
// url: "mongodb://127.0.0.1:27017/MAPF_V2"
url: "mongodb://127.0.0.1:27017/MAPF_V2"
url: process.env.MONGO_DB_URL || "mongodb://127.0.0.1:27017/MAPF_V2"

};