Skip to content

Commit

Permalink
add gh workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
targoninc-alex committed May 27, 2024
1 parent 1f5fcc5 commit c43a9fd
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Docker Image

on:
push:
branches: [main]
workflow_dispatch:

jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/[email protected]

- name: Log in to Docker registry
uses: docker/[email protected]
with:
registry: ${{ secrets.REGISTRY_HOST }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASS }}

- name: Generate image name
id: reponame
uses: ashley-taylor/[email protected]
with:
value: ${{ github.repository }}
regex: /|-|_
flags: g
replacement: _

- name: Show image name
run: echo "${{ steps.reponame.outputs.value }}"

- name: Build and tag Docker image
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile
push: false
tags: ${{ secrets.REGISTRY_HOST }}/${{ steps.reponame.outputs.value }}:latest, ${{ secrets.REGISTRY_HOST }}/${{ steps.reponame.outputs.value }}:${{ github.run_number }}

- name: Push Docker image to registry
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile
push: true
tags: ${{ secrets.REGISTRY_HOST }}/${{ steps.reponame.outputs.value }}:latest, ${{ secrets.REGISTRY_HOST }}/${{ steps.reponame.outputs.value }}:${{ github.run_number }}
28 changes: 28 additions & 0 deletions docker-compose-built.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: '3'

services:
app:
container_name: app
image: ${DOCKER_IMAGE_APP}
restart: always
ports:
- "3000:3000"
- "8912:8912"
depends_on:
- db
env_file:
- .env

db:
container_name: mariadb
image: mariadb:10.5
restart: always
ports:
- "3306:3306"
env_file:
- .env
volumes:
- db_data:/var/lib/mysql

volumes:
db_data:

0 comments on commit c43a9fd

Please sign in to comment.