Skip to content

Commit 0d151a4

Browse files
authored
Merge pull request #3 from tommerty/copilot/fix-be6e5914-3fcd-41e1-af00-37240fb151e9
Fix Docker port configuration for flexible Coolify deployment
2 parents ccdd68c + 5a0e8c5 commit 0d151a4

File tree

8 files changed

+5764
-21
lines changed

8 files changed

+5764
-21
lines changed

.env.example

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Environment Configuration for Production
22
NODE_ENV=production
3+
4+
# External port configuration (for Docker port mapping)
5+
# The application runs on port 3000 internally
6+
# Change this to map to a different external port if needed (e.g., PORT=3009)
7+
# Example: PORT=3009 maps external port 3009 to internal port 3000
38
PORT=3000
49

510
# Optional: Add any additional environment variables here

COOLIFY.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,18 @@
55
### Build Configuration
66
- **Build Command**: `pnpm install && pnpm build`
77
- **Start Command**: `pnpm start`
8-
- **Port**: 3000
8+
- **Port**: Application runs on port 3000 internally
99
- **Docker Build**: Uses the included Dockerfile
1010

1111
### Environment Variables
1212
- `NODE_ENV=production`
13-
- `PORT=3000`
13+
- `PORT=<external-port>` (e.g., `PORT=3009` to expose on port 3009, maps to internal port 3000)
14+
15+
### Port Configuration
16+
- **Internal Port**: Always 3000 (application runs on this port inside the container)
17+
- **External Port**: Configurable via PORT environment variable (defaults to 3000)
18+
- **Example**: Setting `PORT=3009` maps external port 3009 to internal port 3000
19+
- **Avoids Conflicts**: If port 3000 is occupied, set PORT to any available port (e.g., 3009, 8080, etc.)
1420

1521
### Health Check
1622
- **Path**: `/`
@@ -34,4 +40,7 @@ The included `docker-compose.yml` can be used for local testing or as a referenc
3440
- This is a React Router application with SSR
3541
- Uses pnpm as package manager
3642
- Includes health checks for better reliability
37-
- Optimized for production deployment
43+
- Optimized for production deployment
44+
- Application always runs on port 3000 internally
45+
- External port mapping is configurable via PORT environment variable
46+
- Docker health checks use the internal port 3000

DEPLOYMENT.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,23 @@ This guide will help you deploy the Stream Deck Icons application to Coolify.
3939

4040
Set the following environment variables in Coolify:
4141
- `NODE_ENV=production`
42-
- `PORT=3000`
42+
- `PORT=<external-port>` (e.g., `PORT=3009` to expose on port 3009)
43+
44+
**Important**: The application runs on port 3000 internally. The PORT variable only configures the external port mapping to avoid conflicts.
4345

4446
## Step 5: Build Settings
4547

4648
Configure the following in Coolify:
4749
- **Build Command**: `pnpm install && pnpm build`
4850
- **Start Command**: `pnpm start`
49-
- **Port**: 3000
51+
- **Port**: Set to match your PORT environment variable (e.g., 3009 for external access)
5052
- **Health Check Path**: `/`
5153

54+
**Port Configuration**:
55+
- Internal port: Always 3000 (application runs here)
56+
- External port: Set via PORT environment variable (defaults to 3000)
57+
- Example: `PORT=3009` maps external port 3009 → internal port 3000
58+
5259
## Step 6: Deploy
5360

5461
### Automatic Deployment (Recommended)
@@ -68,8 +75,14 @@ Configure the following in Coolify:
6875
- Check that Node.js 22 is available
6976

7077
2. **Health check fails**
71-
- Verify the application is running on port 3000
78+
- Verify the application is running on port 3000 internally
7279
- Check application logs in Coolify
80+
- Ensure PORT environment variable is set for external port mapping only
81+
82+
3. **Port conflicts**
83+
- If you get "port already allocated" errors, set PORT to an available port
84+
- Example: `PORT=3009` or `PORT=8080` to avoid conflicts
85+
- The application will still run on port 3000 internally
7386

7487
3. **GitHub Actions deployment fails**
7588
- Verify webhook URL and token are correctly set

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ COPY --from=builder /app/package.json ./package.json
2828
ENV NODE_ENV=production
2929
ENV PORT=3000
3030

31-
# Expose port
32-
EXPOSE 3009
31+
# Expose the port the app runs on
32+
EXPOSE 3000
3333

3434
CMD ["pnpm", "start"]

README.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ This project is configured for deployment on [Coolify](https://coolify.io). Foll
5656
2. **Configure Build Settings**:
5757
- Build Command: `pnpm install && pnpm build`
5858
- Start Command: `pnpm start`
59-
- Port: 3000
59+
- Port: Set to match your PORT environment variable (defaults to 3000)
6060
- Use the included `docker-compose.yml` or `Dockerfile`
6161

6262
3. **Environment Variables**:
6363
- `NODE_ENV=production`
64-
- `PORT=3000`
64+
- `PORT=<your-preferred-port>` (e.g., `PORT=3009` if port 3000 is occupied)
6565

6666
4. **GitHub Actions Deployment**:
6767
- Add the following secrets to your GitHub repository:
@@ -82,14 +82,21 @@ To build and run using Docker:
8282
```bash
8383
docker build -t streamdeck-icons .
8484

85-
# Run the container
85+
# Run the container on port 3000 (default)
8686
docker run -p 3000:3000 streamdeck-icons
87+
88+
# Or run on a custom port to avoid conflicts (e.g., 3009 externally, 3000 internally)
89+
docker run -p 3009:3000 streamdeck-icons
8790
```
8891

8992
Or use Docker Compose:
9093

9194
```bash
92-
docker-compose up -d
95+
# Default configuration (port 3000)
96+
docker compose up -d
97+
98+
# Custom external port to avoid conflicts
99+
PORT=3009 docker compose up -d
93100
```
94101

95102
The containerized application can be deployed to any platform that supports Docker, including:

docker-compose.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
version: '3.8'
2-
31
services:
42
app:
53
build:
64
context: .
75
dockerfile: Dockerfile
86
ports:
9-
- "3009:3009"
7+
- "${PORT:-3000}:3000"
108
environment:
119
- NODE_ENV=production
12-
- PORT=3009
10+
- PORT=3000
1311
restart: unless-stopped
1412
healthcheck:
1513
test: ["CMD", "curl", "-f", "http://localhost:3000/"]

0 commit comments

Comments
 (0)