Skip to content

Commit c95aeb1

Browse files
authored
Merge pull request #117 from refactor-group/debug_and_fix_backend_api_version
2 parents 5fa13a5 + 481e639 commit c95aeb1

File tree

5 files changed

+41
-29
lines changed

5 files changed

+41
-29
lines changed

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# NEXT_PUBLIC_BACKEND_SERVICE_PROTOCOL="http"
77
# NEXT_PUBLIC_BACKEND_SERVICE_PORT=4000
88
# NEXT_PUBLIC_BACKEND_SERVICE_HOST="localhost"
9-
# NEXT_PUBLIC_BACKEND_API_VERSION="0.0.1"
9+
# NEXT_PUBLIC_BACKEND_API_VERSION="1.0.0-beta1"
1010
# NEXT_PUBLIC_TIPTAP_APP_ID="<tiptap-app-id>"
1111

1212
# NEXT_PUBLIC_TIPTAP_APP_ID=""

.github/workflows/build_and_push_nonproduction_images.yml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ on:
77
branches: [main]
88
types: [opened, synchronize, reopened]
99
workflow_dispatch:
10+
inputs:
11+
enable_env_var_debugging: # Optional debugging parameter useful to debug the build args and env vars
12+
description: 'Enable build args & env vars debugging' # Help text shown in UI
13+
required: false # Not required to run the workflow
14+
default: false # Disabled by default
15+
type: boolean # Simple checkbox in the UI
1016

1117
env:
1218
REGISTRY: ghcr.io
@@ -15,7 +21,7 @@ env:
1521

1622
jobs:
1723
build_and_push_amd64:
18-
runs-on: ubuntu-22.04
24+
runs-on: ubuntu-24.04
1925

2026
permissions:
2127
contents: read
@@ -36,7 +42,19 @@ jobs:
3642
username: ${{ github.actor }}
3743
password: ${{ secrets.GITHUB_TOKEN }}
3844

39-
- name: Set image tag
45+
- name: Debug Environment Variables
46+
if: ${{ inputs.enable_env_var_debugging == true }} # Only run when debugging is enabled
47+
run: |
48+
echo "Building with the following environment variables:" && \
49+
echo "NEXT_PUBLIC_BACKEND_SERVICE_PROTOCOL: ${NEXT_PUBLIC_BACKEND_SERVICE_PROTOCOL}" && \
50+
echo "NEXT_PUBLIC_BACKEND_SERVICE_HOST: ${NEXT_PUBLIC_BACKEND_SERVICE_HOST}" && \
51+
echo "NEXT_PUBLIC_BACKEND_SERVICE_PORT: ${NEXT_PUBLIC_BACKEND_SERVICE_PORT}" && \
52+
echo "NEXT_PUBLIC_BACKEND_API_VERSION: ${NEXT_PUBLIC_BACKEND_API_VERSION}" && \
53+
echo "FRONTEND_SERVICE_INTERFACE: ${FRONTEND_SERVICE_INTERFACE}" && \
54+
echo "FRONTEND_SERVICE_PORT: ${FRONTEND_SERVICE_PORT}"
55+
56+
57+
- name: Set Image Tag
4058
id: vars
4159
run: |
4260
BRANCH_NAME=${GITHUB_HEAD_REF:-${GITHUB_REF##*/}}
@@ -66,7 +84,7 @@ jobs:
6684
cache-to: type=gha,mode=max,scope=amd64
6785

6886
build_and_push_arm64:
69-
runs-on: ubuntu-22.04
87+
runs-on: ubuntu-24.04
7088

7189
permissions:
7290
contents: read
@@ -87,7 +105,7 @@ jobs:
87105
username: ${{ github.actor }}
88106
password: ${{ secrets.GITHUB_TOKEN }}
89107

90-
- name: Set image tag
108+
- name: Set Image Tag
91109
id: vars
92110
run: |
93111
BRANCH_NAME=${GITHUB_HEAD_REF:-${GITHUB_REF##*/}}

.github/workflows/deploy_to_do.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ on:
88
jobs:
99
deploy:
1010
name: Deploy Frontend to DigitalOcean # Job name for display
11-
runs-on: ubuntu-24.04 # Use latest Ubuntu runner
12-
permissions: # job-level permissions necessary for Tailscale
13-
contents: read # Read repository contents
14-
id-token: write # Required for OIDC token operations (Tailscale)
11+
runs-on: ubuntu-24.04
12+
environment: production # Use the production environment settings
13+
permissions: # job-level permissions necessary for Tailscale
14+
contents: read # Read repository contents
15+
id-token: write # Required for OIDC token operations (Tailscale)
1516

1617
steps:
1718
# Set up Tailscale connection to securely access the droplet

Dockerfile

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ FROM node:22-alpine3.19 AS base
55
ARG BUILDPLATFORM
66
ARG TARGETPLATFORM
77

8+
# Build-time args from docker-compose or GitHub Actions
9+
ARG NEXT_PUBLIC_BACKEND_SERVICE_PROTOCOL
10+
ARG NEXT_PUBLIC_BACKEND_SERVICE_HOST
11+
ARG NEXT_PUBLIC_BACKEND_SERVICE_PORT
12+
ARG NEXT_PUBLIC_BACKEND_API_VERSION
13+
ARG FRONTEND_SERVICE_INTERFACE
14+
ARG FRONTEND_SERVICE_PORT
15+
816
# Optional diagnostics (doesn't affect final image)
917
RUN echo "Build Platform: ${BUILDPLATFORM} -> Target Platform: ${TARGETPLATFORM}"
1018

@@ -23,29 +31,12 @@ WORKDIR /app
2331
COPY --from=deps /app/node_modules ./node_modules
2432
COPY . .
2533

26-
# Build-time args from docker-compose or GitHub Actions
27-
ARG NEXT_PUBLIC_BACKEND_SERVICE_PROTOCOL
28-
ARG NEXT_PUBLIC_BACKEND_SERVICE_HOST
29-
ARG NEXT_PUBLIC_BACKEND_SERVICE_PORT
30-
ARG NEXT_PUBLIC_BACKEND_API_VERSION
31-
ARG FRONTEND_SERVICE_INTERFACE
32-
ARG FRONTEND_SERVICE_PORT
33-
3434
# Pass them as ENV so Next.js static build can access
3535
ENV NEXT_PUBLIC_BACKEND_SERVICE_PROTOCOL=$NEXT_PUBLIC_BACKEND_SERVICE_PROTOCOL
3636
ENV NEXT_PUBLIC_BACKEND_SERVICE_HOST=$NEXT_PUBLIC_BACKEND_SERVICE_HOST
3737
ENV NEXT_PUBLIC_BACKEND_SERVICE_PORT=$NEXT_PUBLIC_BACKEND_SERVICE_PORT
3838
ENV NEXT_PUBLIC_BACKEND_API_VERSION=$NEXT_PUBLIC_BACKEND_API_VERSION
3939

40-
# Optional: Print the values to verify they are set correctly
41-
RUN echo "Building with the following environment variables:" && \
42-
echo "NEXT_PUBLIC_BACKEND_SERVICE_PROTOCOL: ${NEXT_PUBLIC_BACKEND_SERVICE_PROTOCOL}" && \
43-
echo "NEXT_PUBLIC_BACKEND_SERVICE_HOST: ${NEXT_PUBLIC_BACKEND_SERVICE_HOST}" && \
44-
echo "NEXT_PUBLIC_BACKEND_SERVICE_PORT: ${NEXT_PUBLIC_BACKEND_SERVICE_PORT}" && \
45-
echo "NEXT_PUBLIC_BACKEND_API_VERSION: ${NEXT_PUBLIC_BACKEND_API_VERSION}" && \
46-
echo "FRONTEND_SERVICE_INTERFACE: ${FRONTEND_SERVICE_INTERFACE}" && \
47-
echo "FRONTEND_SERVICE_PORT: ${FRONTEND_SERVICE_PORT}"
48-
4940
# Build the Next.js application
5041
# Note: Use `next build` to build the application for production
5142
RUN npm run build
@@ -69,8 +60,10 @@ USER nextjs
6960
# Expose the port
7061
EXPOSE 3000
7162

72-
ARG FRONTEND_SERVICE_INTERFACE
73-
ARG FRONTEND_SERVICE_PORT
63+
ENV NEXT_PUBLIC_BACKEND_SERVICE_PROTOCOL=$NEXT_PUBLIC_BACKEND_SERVICE_PROTOCOL
64+
ENV NEXT_PUBLIC_BACKEND_SERVICE_HOST=$NEXT_PUBLIC_BACKEND_SERVICE_HOST
65+
ENV NEXT_PUBLIC_BACKEND_SERVICE_PORT=$NEXT_PUBLIC_BACKEND_SERVICE_PORT
66+
ENV NEXT_PUBLIC_BACKEND_API_VERSION=$NEXT_PUBLIC_BACKEND_API_VERSION
7467

7568
# Runtime ENV for Compose
7669
ENV HOSTNAME=$FRONTEND_SERVICE_INTERFACE

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ When running locally on a development machine you can manually set the applicati
2323
NEXT_PUBLIC_BACKEND_SERVICE_PROTOCOL="http"
2424
NEXT_PUBLIC_BACKEND_SERVICE_PORT=4000
2525
NEXT_PUBLIC_BACKEND_SERVICE_HOST="localhost"
26-
NEXT_PUBLIC_BACKEND_API_VERSION="0.0.1"
26+
NEXT_PUBLIC_BACKEND_API_VERSION="1.0.0-beta1"
2727
2828
# TIPTAP_APP_ID originates from your TipTap Cloud Dashboard
2929
NEXT_PUBLIC_TIPTAP_APP_ID="<TIPTAP_APP_ID>"

0 commit comments

Comments
 (0)