feat: add docker deployment configuration (#311)
This commit is contained in:
33
.dockerignore
Normal file
33
.dockerignore
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
pnpm-debug.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
|
||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
dist-ssr
|
||||||
|
dev-dist
|
||||||
|
*.local
|
||||||
|
.env
|
||||||
|
|
||||||
|
# Editor directories and files
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/extensions.json
|
||||||
|
.idea
|
||||||
|
.DS_Store
|
||||||
|
*.suo
|
||||||
|
*.ntvs*
|
||||||
|
*.njsproj
|
||||||
|
*.sln
|
||||||
|
*.sw?
|
||||||
|
|
||||||
|
# Git
|
||||||
|
.gitignore
|
||||||
|
|
||||||
|
#Docker files
|
||||||
|
docker-compose.yml
|
||||||
|
Dockerfile
|
||||||
41
Dockerfile
Normal file
41
Dockerfile
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
# Step 1: Build the application
|
||||||
|
FROM node:20-alpine as builder
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN npm install && npm run build
|
||||||
|
|
||||||
|
# Step 2: Final container with Nginx and embedded config
|
||||||
|
FROM nginx:alpine
|
||||||
|
|
||||||
|
# Copy only the generated static files
|
||||||
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||||
|
|
||||||
|
# Embed Nginx configuration directly
|
||||||
|
RUN printf "server {\n\
|
||||||
|
listen 80;\n\
|
||||||
|
server_name localhost;\n\
|
||||||
|
root /usr/share/nginx/html;\n\
|
||||||
|
index index.html;\n\
|
||||||
|
\n\
|
||||||
|
location / {\n\
|
||||||
|
try_files \$uri \$uri/ /index.html;\n\
|
||||||
|
}\n\
|
||||||
|
\n\
|
||||||
|
location ~* \\.(?:js|css|woff2?|ttf|otf|eot|ico|jpg|jpeg|png|gif|svg|webp)\$ {\n\
|
||||||
|
expires 30d;\n\
|
||||||
|
access_log off;\n\
|
||||||
|
add_header Cache-Control \"public\";\n\
|
||||||
|
}\n\
|
||||||
|
\n\
|
||||||
|
gzip on;\n\
|
||||||
|
gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/json;\n\
|
||||||
|
gzip_proxied any;\n\
|
||||||
|
gzip_min_length 1024;\n\
|
||||||
|
gzip_comp_level 6;\n\
|
||||||
|
}\n" > /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
|
EXPOSE 80
|
||||||
|
|
||||||
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
12
README.md
12
README.md
@@ -42,6 +42,18 @@ npm install
|
|||||||
# Run the app
|
# Run the app
|
||||||
npm run dev
|
npm run dev
|
||||||
```
|
```
|
||||||
|
## Run Docker
|
||||||
|
```bash
|
||||||
|
# Clone this repository
|
||||||
|
git clone https://github.com/CodyTseng/jumble.git
|
||||||
|
|
||||||
|
# Go into the repository
|
||||||
|
cd jumble
|
||||||
|
|
||||||
|
# Run the docker compose
|
||||||
|
docker compose up --build -d
|
||||||
|
```
|
||||||
|
After finishing, access: http://localhost:8089
|
||||||
|
|
||||||
## Donate
|
## Donate
|
||||||
|
|
||||||
|
|||||||
11
docker-compose.yml
Normal file
11
docker-compose.yml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
version: "3.8"
|
||||||
|
|
||||||
|
services:
|
||||||
|
jumble:
|
||||||
|
container_name: jumble-nginx
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
ports:
|
||||||
|
- "8089:80"
|
||||||
|
restart: unless-stopped
|
||||||
Reference in New Issue
Block a user