This repository has been archived by the owner on Jul 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
4 changed files
with
55 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
GHCR_TOKEN=your_github_token_here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|