Add server docker file and related action tests
This commit is contained in:
@@ -24,6 +24,38 @@ env:
|
||||
PDAB_PORT: ${{ vars.PDAB_PORT }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
|
||||
- name: Install dependencies
|
||||
working-directory: './server'
|
||||
run: npm install
|
||||
|
||||
- name: Build Docker image
|
||||
working-directory: './server'
|
||||
run: docker build -t DRB-Server .
|
||||
|
||||
- name: Run Docker container
|
||||
run: docker run -d --name drb -p 3000:3000 DRB-Server
|
||||
|
||||
- name: Wait for server to start
|
||||
run: sleep 10
|
||||
|
||||
- name: Test server accessibility
|
||||
run: curl -v http://localhost:3000
|
||||
|
||||
- name: Stop Docker container
|
||||
run: docker stop drb
|
||||
|
||||
drb_build_and_test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
|
||||
20
server/Dockerfile
Normal file
20
server/Dockerfile
Normal file
@@ -0,0 +1,20 @@
|
||||
# Use the official Node.js image as the base image
|
||||
FROM node:20
|
||||
|
||||
# Set the working directory inside the container
|
||||
WORKDIR /server
|
||||
|
||||
# Copy package.json and package-lock.json (if available) to the working directory
|
||||
COPY package*.json ./
|
||||
|
||||
# Install dependencies
|
||||
RUN npm install
|
||||
|
||||
# Copy the rest of the application code to the working directory
|
||||
COPY . .
|
||||
|
||||
# Expose the port on which your Node.js application will run
|
||||
EXPOSE 3000
|
||||
|
||||
# Command to run the Node.js application
|
||||
CMD ["node", "server.js"]
|
||||
Reference in New Issue
Block a user