mirror of
https://github.com/deiucanta/chatpad.git
synced 2026-03-11 09:04:31 +00:00
Merge branch 'main' of github.com:deiucanta/chatpad
This commit is contained in:
commit
61dcf4f285
4 changed files with 93 additions and 0 deletions
2
.dockerignore
Normal file
2
.dockerignore
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
node_modules/
|
||||
dist/
|
||||
37
.github/workflows/docker.yml
vendored
Normal file
37
.github/workflows/docker.yml
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
name: ci-docker
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
-
|
||||
name: Login to Github Container Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.CR_PAT }}
|
||||
registry: ghcr.io
|
||||
|
||||
-
|
||||
name: Build and push
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
tags: ghcr.io/${{ github.repository }}:${{ github.sha }}, ghcr.io/${{ github.repository }}:latest
|
||||
29
Dockerfile
Normal file
29
Dockerfile
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
# Build the react project
|
||||
FROM node:18-alpine as builder
|
||||
WORKDIR /app
|
||||
|
||||
# Install the node_modules first
|
||||
COPY package*.json ./
|
||||
RUN npm ci
|
||||
|
||||
# Copy the rest of the files
|
||||
COPY . .
|
||||
|
||||
# Build the react application
|
||||
RUN npm run build
|
||||
|
||||
# Runner image
|
||||
FROM nginx:1.23.3-alpine
|
||||
|
||||
# Copy the nginx configuration
|
||||
COPY ./docker/default.conf.template /etc/nginx/templates/default.conf.template
|
||||
|
||||
# Copy the built react application to the nginx folder
|
||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||
|
||||
# Required NGINX env variables
|
||||
ENV NGINX_ENVSUBST_OUTPUT_DIR=/etc/nginx/conf.d
|
||||
|
||||
# Default env variables
|
||||
ENV PORT=80
|
||||
ENV HOST=0.0.0.0
|
||||
25
docker/default.conf.template
Normal file
25
docker/default.conf.template
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
server {
|
||||
listen $PORT;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
server_tokens off;
|
||||
server_name _;
|
||||
|
||||
gzip on;
|
||||
gzip_disable "msie6";
|
||||
|
||||
gzip_vary on;
|
||||
gzip_proxied any;
|
||||
gzip_comp_level 6;
|
||||
gzip_buffers 16 8k;
|
||||
gzip_http_version 1.1;
|
||||
gzip_min_length 0;
|
||||
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
|
||||
|
||||
location / {
|
||||
try_files $uri /index.html;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in a new issue