Skip to content
This repository has been archived by the owner on Jul 1, 2024. It is now read-only.

Commit

Permalink
chatgpt: generated action, makefile
Browse files Browse the repository at this point in the history
Signed-off-by: Emre YILMAZ <z@emre.xyz>
  • Loading branch information
delirehberi committed Jan 8, 2024
1 parent 315cc30 commit 3a68081
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 2 deletions.
1 change: 1 addition & 0 deletions .env.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GHCR_TOKEN=your_github_token_here
33 changes: 33 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Docker Image Build and Push

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Log in to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: ghcr.io/${{ github.repository_owner }}/utils-ai-plugin:latest

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.env
22 changes: 20 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,38 @@
# Define variables
APP_NAME=utilsworkouse
APP_NAME=utils-ai-plugin
NGINX_CONF=nginx.conf
NGINX_SITES_ENABLED=/etc/nginx/sites-enabled
GHCR_USERNAME=workouse
IMAGE_TAG=latest # or specify a specific tag
GHCR_IMAGE=ghcr.io/$(GHCR_USERNAME)/$(APP_NAME):$(IMAGE_TAG)


-include .env

# Build the Docker image
build:
docker build -t $(APP_NAME) .

# Pull the Docker image from GHCR
pull:
docker pull $(GHCR_IMAGE)

# Run the Docker container
run:
docker run -d -p 5000:5000 --name $(APP_NAME) $(APP_NAME)

login:
ifndef GHCR_TOKEN
$(error GHCR_TOKEN is undefined. Create an .env file with your token.)
endif
@echo "Logging in to GitHub Container Registry..."
@docker login ghcr.io -u $(GHCR_USERNAME) --password=$(GHCR_TOKEN)


# Install NGINX configuration
install:
sudo ln -sf $(NGINX_CONF).conf $(NGINX_SITES_ENABLED)/$(APP_NAME).conf
sudo nginx -t && sudo systemctl reload nginx

.PHONY: build run install
.PHONY: build run install pull login

0 comments on commit 3a68081

Please sign in to comment.