Skip to content

Commit

Permalink
Merge pull request #2 from FFCoder/fixPipelines
Browse files Browse the repository at this point in the history
Fix pipelines
  • Loading branch information
FFCoder authored Aug 30, 2024
2 parents b168aa2 + 283ef3d commit 5480a58
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 39 deletions.
35 changes: 0 additions & 35 deletions .github/workflows/build.yml

This file was deleted.

30 changes: 30 additions & 0 deletions .github/workflows/pushToDockerhubOnCommit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go

name: Build Binaries on Commit

on:
push:
branches-ignore:
- main

jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push Docker images
uses: docker/build-push-action@v6.7.0
with:
platforms: linux/amd64
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/kratomtracker:${{ github.sha }}

29 changes: 29 additions & 0 deletions .github/workflows/pushToDockerhubOnMain.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go

name: Build Binaries on Main

on:
push:
branches: [ "main" ]

jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push Docker images
uses: docker/build-push-action@v6.7.0
with:
context: .
file: Dockerfile
platforms: linux/amd64
tags: ${{ secrets.DOCKERHUB_USERNAME }}/kratomtracker:latest
push: true

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build stage
FROM golang:1.22-bullseye as build
FROM golang:1.22-bullseye AS build

LABEL authors="Jonathon Chambers"
LABEL description="This is the Dockerfile for setting up the Kratom Tracker Application"
Expand Down
17 changes: 14 additions & 3 deletions build_prod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ export APP_NAME="kratom_tracker"
export VITE_API_URL="/api"
export CGO_ENABLED=1 # Required for sqlite3

# Validate pnpm is installed
if ! command -v pnpm &> /dev/null
then
echo "pnpm could not be found"
echo "attempting to install pnpm"
npm install -g pnpm
if ! command -v pnpm &> /dev/null
then
echo "pnpm failed to install"
exit 1
fi
fi

# Make the output
mkdir -p output

Expand All @@ -14,9 +27,7 @@ rm -rf output/*
# Build the frontend
cd frontend || exit 1

# Remove package-lock.json
rm -f package-lock.json
#npm install --legacy-peer-deps
pnpm install
npm run build:prod

# Build the backend
Expand Down

0 comments on commit 5480a58

Please sign in to comment.