forked from siyoungoh/node-github-action-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (32 loc) · 1003 Bytes
/
nodejs.yml
File metadata and controls
42 lines (32 loc) · 1003 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: Node.js CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
services:
docker:
image: docker:20.10.12
options: --privileged
ports:
- 8080:8080
steps:
- uses: actions/checkout@v3
# Docker 로그인
- name: Log in to Docker Hub
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
- name: Build the Docker image
run: |
docker build . --file Dockerfile --tag nodejs-app:latest
- name: Run the Docker container
run: |
docker run -d -p 8080:8080 --name mynodeapp nodejs-app:latest
# Test dependencies are typically installed via a project's package.json
# and should ideally not be handled separately in CI workflows.
- name: Install test dependencies
run: npm install mocha chai chai-http
- name: Run tests
run: npm test