-
Notifications
You must be signed in to change notification settings - Fork 0
35 lines (31 loc) · 1016 Bytes
/
docker-ci.yml
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
name: Docker Image CI
on:
push:
branches: [ "main" ]
env:
# Use docker.io for Docker Hub if empty
REGISTRY: docker.io
# github.repository as <account>/<repo>
IMAGE_NAME: jaimenavarro/web-container
# Docker username
USERNAME: ${{ github.actor }}
# Docker password
PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
jobs:
build:
runs-on: ubuntu-latest
environment: test
steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: |
cd web-server-container/
docker build . --file Dockerfile --tag ${{ env.IMAGE_NAME }}:$(date +%Y%m%d)
- name: List docker images
run: docker images
- name: Docker login
run: docker login -u ${{ env.USERNAME }} -p ${{ env.PASSWORD }}
- name: Docker push
run: docker push ${{ env.IMAGE_NAME }}:$(date +%Y%m%d)
- name: Docker push latest version
run: docker tag ${{ env.IMAGE_NAME }}:$(date +%Y%m%d) ${{ env.IMAGE_NAME }}:latest ; docker push ${{ env.IMAGE_NAME }}:latest