-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (50 loc) · 1.71 KB
/
node_js_containers.yml
File metadata and controls
56 lines (50 loc) · 1.71 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Dockerized NodeJs App
on: push
jobs:
docker-steps:
# Docker containers can only run on ubuntu, it cannot run on Mac or Windows.
runs-on: ubuntu-latest
container:
image: node:10.18.0-jessie
steps:
- name: log node version
run: node -v
# This will run the image node:12.14.1-alpine3.10 which runs instead of the other one specified above
- name: Step with docker
uses: docker://node:12.14.1-alpine3.10
with:
entrypoint: '/usr/local/bin/node'
args: '-v'
# Run a specific script from within the docker container
- uses: actions/checkout@v1
- name: Run a script
uses: docker://node:12.14.1-alpine3.10
with:
entrypoint: ./script.sh
args: "Some string"
# Send a Slack message
- name: send a slack message
uses: docker://technosophos/slack-notify
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_MESSAGE: "Hello slack"
node-docker:
runs-on: ubuntu-latest
# Instead of the 'container' key, specify 'services'
services:
# The following is very similar to a docker_compose.yml file
app:
# Specify the username/imagename on dockerhub.com
image: alialaa17/node-api
ports:
- 3001:3000
mongo:
image: mongo
ports:
- "27017:27017"
steps:
- name: Post a user
# Send a HTTP POST request to create a user to the mongo DB.
run: 'curl -X POST http://localhost:3001/api/user -H ''Content-Type: application/json'' -d ''{"username": "hello", "address": "dwded"}'''
- name: Get Users
run: curl http://localhost:3001/api/users