Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .github/scripts/staging/Dockerfile

This file was deleted.

2 changes: 2 additions & 0 deletions .github/workflows/on_call_staging_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ jobs:
run: |
# Copy staging files into the _site directory for the docker build
cp .github/scripts/staging/default.conf _site/httpd.conf
# Also copy default.conf for the consolidated Dockerfile to support fallback
cp .github/scripts/staging/default.conf _site/default.conf

- name: Run as service and test
run: |
Expand Down
22 changes: 20 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,26 @@ FROM httpd:2.4.64 AS httpd_serve
# Install curl for healthcheck
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*

# COPY _site /var/www/html/
COPY .github/scripts/staging/default.conf /usr/local/apache2/conf/httpd.conf
# Copy Apache configuration - flexible approach for both contexts
# For staging: httpd.conf will be in the build context
# For development: default.conf will be sourced from .github/scripts/staging/
COPY . /tmp/build_context/
RUN if [ -f /tmp/build_context/httpd.conf ]; then \
echo "Using httpd.conf for staging configuration"; \
cp /tmp/build_context/httpd.conf /usr/local/apache2/conf/httpd.conf; \
elif [ -f /tmp/build_context/default.conf ]; then \
echo "Using default.conf from build context"; \
cp /tmp/build_context/default.conf /usr/local/apache2/conf/httpd.conf; \
elif [ -f /tmp/build_context/.github/scripts/staging/default.conf ]; then \
echo "Using default.conf from .github/scripts/staging/"; \
cp /tmp/build_context/.github/scripts/staging/default.conf /usr/local/apache2/conf/httpd.conf; \
else \
echo "ERROR: No configuration file found"; \
exit 1; \
fi

# Copy site content to web directory
COPY . /usr/local/apache2/htdocs/

FROM base AS tests

Expand Down
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,27 @@ orionrobotsgithubio-web-1 | ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) [x86

## Staging Test Environment

The staging test environment is located in `.github/scripts/staging/` and contains Docker configuration files used for testing the built site before deployment. This environment:
The staging test environment uses Docker Compose to run the built site with Apache configuration that mirrors the hosting environment. This environment:

- Tests the site with Apache configuration that mirrors the hosting environment
- Validates that htaccess rules work correctly
- Validates that htaccess rules work correctly
- Ensures the site serves properly before deployment

### Running the Staging Environment

To run the staging environment locally using Docker Compose:

```bash
# Build the site first (if not already built)
docker compose up --build dist

# Start the staging service
docker compose up --build staging
```

The staging service will be available at http://localhost:8080

The staging environment automatically uses the consolidated `httpd_serve` Docker stage from the main Dockerfile, ensuring consistency between development and CI/CD environments.

The staging tests run automatically in CI/CD workflows when changes are pushed to the master branch or in pull requests.

3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ services:
staging:
build:
context: ./_site
dockerfile: ../.github/scripts/staging/Dockerfile
dockerfile: ../Dockerfile
target: httpd_serve
ports:
- 8080:80
healthcheck:
Expand Down