Adding the image build for container
This commit is contained in:
1 parent
0ead6945e4
commit
4aca9f08d1
2 files changed
+28
-9
No files matched your search
@@ -1,18 +1,37 @@
|
||||
name: Docker Image CI
|
||||
|
||||
name: Build and Push Docker Image
|
||||
# This workflow is manually triggered from the "Actions" tab in GitHub.
|
||||
# It requires a single input: the version tag of the flood repository to use.
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
schedule:
|
||||
- cron: '0 0 3 * *' # This runs at midnight on the first day of every month
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set Image name
|
||||
run: |
|
||||
echo "IMAGE_NAME=k2patel/apcupsd-client:latest" >> $GITHUB_ENV
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_TOKEN }}
|
||||
|
||||
- name: Build the Docker image
|
||||
run: docker build . --file Dockerfile --tag apcupsd-client:$(date +%s)
|
||||
id: build
|
||||
run: |
|
||||
docker build . -t ${{ env.IMAGE_NAME }}
|
||||
|
||||
- name: Push the Docker image
|
||||
run: docker push ${{ env.IMAGE_NAME }}
|
||||
+3
-3
@@ -4,16 +4,16 @@ services:
|
||||
build: .
|
||||
container_name: apcups-dashboard
|
||||
ports:
|
||||
- "8000:8000"
|
||||
- "10280:8000"
|
||||
environment:
|
||||
- REDIS_URL=redis://redis:6379/0
|
||||
depends_on:
|
||||
- redis
|
||||
restart: always
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: redis
|
||||
ports:
|
||||
- "6379:6379"
|
||||
restart: always
|
||||
# Enable persistence so UPS configuration stored in Redis survives restarts.
|
||||
# Using both RDB snapshots (default schedule) and AOF for durability.
|
||||
command: ["redis-server", "--appendonly", "yes", "--appendfsync", "everysec"]
|
||||
|
||||
Reference in new issue
Block a user