Dockerize hatch.surf homepage
- Created Dockerfile using nginx:alpine to serve static files - Created docker-compose.yml for easy local development - Added .dockerignore to exclude unnecessary files - Updated README with Docker instructions - Tested locally to ensure site runs correctly Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
parent
b98a6afc76
commit
da98ce0c41
12
site/.dockerignore
Normal file
12
site/.dockerignore
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
.dockerignore
|
||||||
|
Dockerfile
|
||||||
|
docker-compose.yml
|
||||||
|
README.md
|
||||||
|
*.md
|
||||||
|
*.bak
|
||||||
|
*.log
|
||||||
|
node_modules
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
19
site/Dockerfile
Normal file
19
site/Dockerfile
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# Dockerfile for hatch.surf homepage
|
||||||
|
# Uses nginx:alpine to serve static files
|
||||||
|
|
||||||
|
FROM nginx:alpine
|
||||||
|
|
||||||
|
# Remove default nginx static assets
|
||||||
|
RUN rm -rf /usr/share/nginx/html/*
|
||||||
|
|
||||||
|
# Copy static files from site directory
|
||||||
|
COPY . /usr/share/nginx/html/
|
||||||
|
|
||||||
|
# Copy custom nginx configuration for SPA routing if needed
|
||||||
|
# COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
|
# Expose port 80
|
||||||
|
EXPOSE 80
|
||||||
|
|
||||||
|
# Start nginx
|
||||||
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
@ -79,6 +79,30 @@ Or with Node.js:
|
|||||||
npx serve site
|
npx serve site
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Docker
|
||||||
|
|
||||||
|
To run the site in Docker:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd site
|
||||||
|
# Build and run with docker compose
|
||||||
|
docker compose up -d
|
||||||
|
|
||||||
|
# Or build and run with docker
|
||||||
|
docker build -t hatch-homepage .
|
||||||
|
docker run -d -p 3000:80 hatch-homepage
|
||||||
|
```
|
||||||
|
|
||||||
|
The site will be available at http://localhost:3000
|
||||||
|
|
||||||
|
To stop the container:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose down
|
||||||
|
# Or
|
||||||
|
docker stop $(docker ps -q --filter ancestor=hatch-homepage)
|
||||||
|
```
|
||||||
|
|
||||||
## SEO Checklist
|
## SEO Checklist
|
||||||
|
|
||||||
- [x] H1 = title
|
- [x] H1 = title
|
||||||
|
|||||||
11
site/docker-compose.yml
Normal file
11
site/docker-compose.yml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
services:
|
||||||
|
hatch-homepage:
|
||||||
|
build: .
|
||||||
|
ports:
|
||||||
|
- "3000:80"
|
||||||
|
volumes:
|
||||||
|
- .:/usr/share/nginx/html:ro
|
||||||
|
environment:
|
||||||
|
- NGINX_HOST=localhost
|
||||||
|
- NGINX_PORT=80
|
||||||
|
restart: unless-stopped
|
||||||
Loading…
Reference in New Issue
Block a user