Skip to content

Commit 38f0863

Browse files
Merge pull request #42 from developmentseed/feature/docker
Adds Dockerfile for easy setup
2 parents 6268cdb + 7aa35b3 commit 38f0863

File tree

14 files changed

+238
-44
lines changed

14 files changed

+238
-44
lines changed

.dockerignore

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Dependencies
2+
node_modules
3+
**/node_modules
4+
.pnp
5+
.pnp.js
6+
7+
# Testing
8+
coverage
9+
**/coverage
10+
11+
# Production builds
12+
dist
13+
**/dist
14+
build
15+
**/build
16+
17+
# Cache directories
18+
.cache
19+
**/.cache
20+
.npm
21+
.eslintcache
22+
.vite
23+
.nx
24+
**/.parcel-cache
25+
26+
# Environment files
27+
.env.*
28+
!.env.example
29+
30+
# IDE specific files
31+
.idea
32+
.vscode
33+
*.swp
34+
*.swo
35+
36+
# OS specific files
37+
.DS_Store
38+
Thumbs.db
39+
40+
# Logs
41+
logs
42+
*.log
43+
npm-debug.log*
44+
yarn-debug.log*
45+
yarn-error.log*
46+
47+
# Temporary files
48+
*.tmp
49+
*.temp

.github/workflows/checks.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ jobs:
103103
build:
104104
needs: prep
105105
runs-on: ubuntu-latest
106+
# Just testing purposes
107+
env:
108+
REACT_APP_STAC_API: https://stac.eoapi.dev
109+
PUBLIC_URL: http://stac-manager.ds.io
106110

107111
steps:
108112
- name: Checkout
@@ -123,5 +127,8 @@ jobs:
123127
- name: Install
124128
run: npm install
125129

130+
- name: Create .env file
131+
run: mv packages/client/.env.example packages/client/.env
132+
126133
- name: Test
127134
run: npm run all:build

.github/workflows/deploy-gh.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ jobs:
4747
- name: Install
4848
run: npm install
4949

50+
- name: Create .env file
51+
run: mv packages/client/.env.example packages/client/.env
52+
5053
- name: Setup SPA on Github Pages
5154
run: node packages/client/tasks/setup-gh-pages.mjs
5255

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,4 @@ tmp
5858
.tmp
5959
dist
6060
parcel-bundle-reports
61-
.nx
61+
.nx

Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Use an official Node.js runtime as a parent image
2+
FROM node:slim
3+
4+
# Set the working directory
5+
WORKDIR /app
6+
7+
# Copy the rest of the application code
8+
COPY . .
9+
10+
# Install dependencies
11+
RUN npm i
12+
RUN npm i -g http-server
13+
14+
RUN npm run all:build
15+
16+
EXPOSE 80
17+
18+
ENTRYPOINT ["http-server", "-p", "80", "packages/client/dist"]

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,20 @@ All the packages are located in the `packages` directory structured as follows:
2020
To set up the project for development, follow the instructions in the [development documentation](./DEVELOPMENT.md) and get familiar with the app architecture and the plugin system by reading the [technical documentation](./docs/README.md).
2121

2222
## License
23-
This project is licensed under the MIT license - see the LICENSE.md file for details.
23+
This project is licensed under the MIT license - see the LICENSE.md file for details.
24+
25+
## Docker
26+
To run the STAC-Manager in a Docker container, you can use the provided Dockerfile.
27+
28+
**Build the Docker image**
29+
```bash
30+
docker build -t stac-manager .
31+
```
32+
33+
**Run the Docker container**
34+
```bash
35+
docker run --rm -p 8080:80 --name stac-manager -e 'PUBLIC_URL=http://your-url.com' stac-manager
36+
```
37+
38+
> [!NOTE]
39+
> The application performs a complete build during container startup to ensure environment variables are properly integrated. This process may take a couple minutes to complete.

packages/client/.env

Lines changed: 0 additions & 18 deletions
This file was deleted.

packages/client/.env.example

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# =============================================
2+
# STAC Manager Environment Example File
3+
# =============================================
4+
# IMPORTANT: DO NOT MODIFY THIS FILE!
5+
# Instead, create a copy named '.env' and modify that file.
6+
# This example file serves as a template and documentation.
7+
# =============================================
8+
9+
# =================
10+
# App Configuration
11+
# =================
12+
13+
# The title of the application shown in browser tab and headers
14+
APP_TITLE=STAC Manager
15+
16+
# A brief description of the application for metadata purposes
17+
APP_DESCRIPTION=Plugin based STAC editor
18+
19+
# The base URL where the app is being served from
20+
# DO NOT set this in the .env file. Set it as an environment variable before building.
21+
# See the README for instructions.
22+
# PUBLIC_URL= Do not set here
23+
24+
# ===============
25+
# API Integration
26+
# ===============
27+
28+
# URL of the STAC Browser instance (optional)
29+
# If not set, will default to Radiant Earth's STAC Browser
30+
REACT_APP_STAC_BROWSER=
31+
32+
# URL of the STAC API endpoint (required)
33+
# This is the API the app will interact with for STAC operations
34+
REACT_APP_STAC_API=
35+
36+
# ====================
37+
# Keycloak Auth Config
38+
# ====================
39+
# If not provided, authentication will be disabled.
40+
41+
# Base URL of the Keycloak server
42+
REACT_APP_KEYCLOAK_URL=
43+
44+
# Client ID registered in Keycloak
45+
REACT_APP_KEYCLOAK_CLIENT_ID=
46+
47+
# Realm name in Keycloak
48+
REACT_APP_KEYCLOAK_REALM=
49+
50+
# =================
51+
# Theme Customization
52+
# =================
53+
54+
# Primary color for the application theme (hex color code)
55+
# Default: #6A5ACD (SlateBlue)
56+
# REACT_APP_THEME_PRIMARY_COLOR='#6A5ACD'
57+
58+
# Secondary color for the application theme (hex color code)
59+
# Default: #048A81 (Teal)
60+
# REACT_APP_THEME_SECONDARY_COLOR='#048A81'

packages/client/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
# Environment
33
################################################
44

5-
.env.*
5+
.env*
6+
!.env.example

packages/client/README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ See root README.md for instructions on how to install and run the project.
88

99
## Client specific instructions
1010

11+
### Environment Configuration
12+
13+
The application uses environment variables for configuration. A template file `.env.example` is provided as a template.
14+
15+
To configure the application:
16+
1. Copy `.env.example` to `.env`
17+
2. Modify the `.env` file with your specific configuration values
18+
3. Never modify `.env.example` directly as it serves as documentation
19+
1120
Some client options are controlled by environment variables. These are:
1221
```
1322
# App config
@@ -66,4 +75,4 @@ icon-512.png 512x512
6675
favicon.png 32x32
6776
apple-touch-icon.png 360x360
6877
meta-image.png 1920x1080
69-
```
78+
```

0 commit comments

Comments
 (0)