Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 66cc550949 | |||
| 3a0359c1b6 | |||
| b560e2dc1e | |||
| 8abc0ce856 |
@@ -0,0 +1,29 @@
|
|||||||
|
name: Build and Push Matrix-to Docker Image
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
|
||||||
|
- name: Log in to Docker Hub
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
push: true
|
||||||
|
tags: domoel/matrix-to:latest
|
||||||
+16
-14
@@ -1,19 +1,21 @@
|
|||||||
# Verwenden Sie ein Node.js-Image als Basis
|
# Stage 1: Build
|
||||||
FROM node:20-alpine
|
FROM node:20.2-alpine AS build
|
||||||
|
|
||||||
# Setzen Sie das Arbeitsverzeichnis im Container
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Kopieren Sie die package.json und yarn.lock Dateien und installieren Sie die Abhängigkeiten
|
|
||||||
COPY package.json yarn.lock ./
|
COPY package.json yarn.lock ./
|
||||||
RUN yarn install --frozen-lockfile
|
RUN yarn install --frozen-lockfile --production && yarn cache clean
|
||||||
|
|
||||||
# Kopieren Sie den Rest des Codes in das Arbeitsverzeichnis
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Exponieren Sie den Port 5000
|
# Stage 2: Production
|
||||||
EXPOSE 5000
|
FROM nginx:alpine
|
||||||
|
COPY --from=build /app/build /usr/share/nginx/html
|
||||||
|
COPY nginx.conf /etc/nginx/nginx.conf
|
||||||
|
|
||||||
# Starten Sie die Anwendung und setzen Sie die PORT-Umgebungsvariable auf 5000
|
# Expose port 80
|
||||||
ENV PORT=5000
|
EXPOSE 80
|
||||||
CMD ["yarn", "start"]
|
EXPOSE 443
|
||||||
|
|
||||||
|
# Healthcheck
|
||||||
|
HEALTHCHECK CMD curl --fail http://localhost:80 || exit 1
|
||||||
|
|
||||||
|
# Start Nginx server
|
||||||
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
|
|||||||
+10
-5
@@ -1,11 +1,16 @@
|
|||||||
version: '3.8'
|
version: '3.8'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
matrix-to:
|
web:
|
||||||
container_name: Matrix-to
|
|
||||||
image: domoel/matrix-to:latest
|
image: domoel/matrix-to:latest
|
||||||
ports:
|
ports:
|
||||||
- "5000:5000"
|
- "80:80"
|
||||||
restart: unless-stopped
|
|
||||||
environment:
|
environment:
|
||||||
- PORT=5000
|
- NODE_ENV=production
|
||||||
|
volumes:
|
||||||
|
- ./nginx.conf:/etc/nginx/nginx.conf
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "curl", "--fail", "http://localhost:80"]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 3
|
||||||
|
|||||||
Reference in New Issue
Block a user