Skip to content

Commit

Permalink
add docker
Browse files Browse the repository at this point in the history
  • Loading branch information
u4aew committed Jul 7, 2024
1 parent 3575338 commit 142aea0
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 51 deletions.
50 changes: 0 additions & 50 deletions .github/workflows/deploy.yml

This file was deleted.

27 changes: 27 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Docker

on:
push:
branches: [ main ]

jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login 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: u4aew/next:latest
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Используем официальный образ Node.js в качестве базового
FROM node:18-alpine

# Устанавливаем рабочую директорию в контейнере
WORKDIR /app

# Копируем файлы package.json и package-lock.json в контейнер
COPY package*.json ./

# Устанавливаем зависимости
RUN npm install

# Копируем остальные файлы приложения в контейнер
COPY . .

# Собираем приложение
RUN npm run build

# Открываем порт, который будет использоваться для доступа к приложению
EXPOSE 6060

# Определяем команду для запуска приложения
CMD ["npm", "start"]
12 changes: 12 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: '3.8'
services:
web:
build: .
ports:
- "6060:6060"
environment:
NODE_ENV: production
volumes:
- .:/app
- /app/node_modules
command: npm start
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"start": "next start -p 6060",
"lint": "next lint"
},
"dependencies": {
Expand Down

0 comments on commit 142aea0

Please sign in to comment.