Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerfile #2418

Closed
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
18 changes: 18 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
node_modules
npm-debug.log
Dockerfile
.dockerignore
.git
.gitignore
README.md
.env
.env.*
dist
coverage
.nyc_output
*.md
.github
tests
__tests__
*.test.*
*.spec.*
VanshikaSabharwal marked this conversation as resolved.
Show resolved Hide resolved
41 changes: 40 additions & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,45 @@ jobs:
- name: Validate Documents
run: graphql-inspector validate './src/GraphQl/**/*.ts' './talawa-api/schema.graphql'

Docker-Start-Check:
name: Check if Talawa Admin app starts in Docker
runs-on: ubuntu-latest
needs: [Code-Quality-Checks, Test-Application]
steps:
- name: Checkout the Repository
uses: actions/checkout@v4

- name: Set up Docker
uses: docker/setup-buildx-action@v3

VanshikaSabharwal marked this conversation as resolved.
Show resolved Hide resolved
- name: Build Docker image
run: |
docker build -t talawa-admin-app .

VanshikaSabharwal marked this conversation as resolved.
Show resolved Hide resolved
- name: Run Docker Container
run: |
docker run -d --name talawa-admin-app-container -p 4321:4321 talawa-admin-app

- name: Check if Talawa Admin App is running
run: |
timeout=${HEALTH_CHECK_TIMEOUT:-60}
while ! nc -z localhost 4321 && [ $timeout -gt 0 ]; do
sleep 1
timeout=$((timeout-1))
done
if [ $timeout -eq 0 ]; then
echo "Timeout waiting for application to start"
exit 1
fi
curl --fail --silent http://localhost:4321/health || exit 1

- name: Stop Docker Container
if: always()
run: |
docker stop talawa-admin-app-container
docker rm talawa-admin-app-container


Check-Target-Branch:
if: ${{ github.actor != 'dependabot[bot]' }}
name: Check Target Branch
Expand All @@ -262,4 +301,4 @@ jobs:
if: github.event.pull_request.base.ref != 'develop'
run: |
echo "Error: Pull request target branch must be 'develop'. Please refer PR_GUIDELINES.md"
exit 1
exit 1
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM node:20.10.0 AS build

WORKDIR /usr/src/app

VanshikaSabharwal marked this conversation as resolved.
Show resolved Hide resolved
COPY . .

RUN npm install -g typescript

RUN npm install

RUN npm run build
VanshikaSabharwal marked this conversation as resolved.
Show resolved Hide resolved

EXPOSE 4321

CMD ["npm", "run", "serve"]
VanshikaSabharwal marked this conversation as resolved.
Show resolved Hide resolved
5 changes: 3 additions & 2 deletions config/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ export default defineConfig({
],
server: {
// this ensures that the browser opens upon server start
open: true,
// this sets a default port to 3000
open: false,
host: '0.0.0.0',
// this sets a default port to 4321
VanshikaSabharwal marked this conversation as resolved.
Show resolved Hide resolved
port: 4321,
},
});
11 changes: 11 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
services:
app:
build:
context: .
dockerfile: Dockerfile
environment:
- REACT_APP_TALAWA_URL=${REACT_APP_TALAWA_URL}
# volumes:
# - .:/usr/src/app
ports:
- 4321:4321
VanshikaSabharwal marked this conversation as resolved.
Show resolved Hide resolved
Loading