-
Notifications
You must be signed in to change notification settings - Fork 1
72 lines (65 loc) · 2.06 KB
/
cd-using-docker-actions.yml
File metadata and controls
72 lines (65 loc) · 2.06 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Docker Image hangman API CD (using Docker actions)
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 16
cache: 'npm'
cache-dependency-path: hangman-api/package-lock.json
- name: build
working-directory: ./hangman-api
run: |
npm ci
npm run build --if-present
- uses: actions/upload-artifact@v6
with:
name: build-code
path: hangman-api/dist/
# delivery:
# runs-on: ubuntu-latest
# needs: build
# steps:
# - uses: actions/checkout@v6
# - uses: actions/download-artifact@v7
# with:
# name: build-code
# path: hangman-api/dist/
# - name: Build and Push Docker Image
# working-directory: ./hangman-api
# env:
# DOCKER_USER: "jaimesalas" # <your-docker-username>
# DOCKER_REPOSITORY: "hangman-api"
# DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
# run: |
# echo $DOCKER_PASSWORD | docker login --username $DOCKER_USER --password-stdin
# image=$DOCKER_USER/$DOCKER_REPOSITORY:$(date +%s)
# docker build -t $image -f Dockerfile.workflow .
# docker push $image
delivery:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout repo
uses: actions/checkout@v6
- name: Download dist folder as artifact
uses: actions/download-artifact@v7
- name: Docker Hub login
uses: docker/login-action@v3
with:
# registry: by default is set to Docker Hub
username: jtrillo # <your_docker_username>
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker Image
uses: docker/build-push-action@v6
with:
context: ./hangman-api
push: true
tags: jtrillo/hangman-api-actions:latest # <your_docker_username>
file: ./hangman-api/Dockerfile.workflow