From fa0a8673cefd449d19d6e1eca57e497daec0d130 Mon Sep 17 00:00:00 2001 From: Egor Deev Date: Tue, 6 Oct 2026 22:12:25 +0300 Subject: [PATCH] =?UTF-8?q?Docker-=D0=BE=D0=B1=D1=80=D0=B0=D0=B7=20=D1=81?= =?UTF-8?q?=20=D1=81=D0=B0=D0=B9=D1=82=D0=BE=D0=BC=20(nginx)=20=D0=B8=20?= =?UTF-8?q?=D1=80=D0=B5=D0=BB=D0=B8=D0=B7=D1=8B:=20=D0=BE=D0=B1=D1=80?= =?UTF-8?q?=D0=B0=D0=B7=20=D0=BF=D1=83=D0=B1=D0=BB=D0=B8=D0=BA=D1=83=D0=B5?= =?UTF-8?q?=D1=82=D1=81=D1=8F=20=D0=B2=20GHCR=20=D0=BF=D0=BE=20=D1=82?= =?UTF-8?q?=D0=B5=D0=B3=D1=83=20v*?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 6 ++++++ .github/workflows/docker.yml | 35 +++++++++++++++++++++++++++++++++++ Dockerfile | 7 +++++++ README.en.md | 4 ++++ README.md | 4 ++++ docker/nginx.conf | 13 +++++++++++++ 6 files changed, 69 insertions(+) create mode 100644 .dockerignore create mode 100644 .github/workflows/docker.yml create mode 100644 Dockerfile create mode 100644 docker/nginx.conf diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..5867f39 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +.git +.github +docs +*.md +.eslintrc.json +.htmlhintrc diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..241cf55 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,35 @@ +name: Docker + +on: + push: + tags: ["v*"] + workflow_dispatch: + +jobs: + image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v4 + - uses: docker/setup-buildx-action@v3 + - uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/edeev/worldlang + tags: | + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=raw,value=latest + - uses: docker/build-push-action@v6 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6dd37ad --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +# Сайт онлайн-школы языков WorldLang — статика за nginx, /api проксируется на учебный API +FROM nginx:1.27-alpine +COPY docker/nginx.conf /etc/nginx/conf.d/default.conf +COPY index.html account.html /usr/share/nginx/html/ +COPY css /usr/share/nginx/html/css +COPY js /usr/share/nginx/html/js +EXPOSE 80 diff --git a/README.en.md b/README.en.md index eb09f59..a2938c4 100644 --- a/README.en.md +++ b/README.en.md @@ -3,6 +3,7 @@ [Русский](README.md) · **English** [![CI](https://github.com/EDeev/worldlang/actions/workflows/ci.yml/badge.svg)](https://github.com/EDeev/worldlang/actions/workflows/ci.yml) +[![Release](https://img.shields.io/github/v/release/EDeev/worldlang)](https://github.com/EDeev/worldlang/releases) Exam project for the "Web Technologies Basics" course: an online language school site with a course and tutor catalog, applications, a personal account and a map of learning places, built on the course API. @@ -28,6 +29,9 @@ API at `/api`. To run from disk, put the full API URL (given in a comment) into Checks: `node --check js/*.js` and `npx htmlhint *.html` (rules in `.htmlhintrc`, also run by CI). +**Docker:** a prebuilt image — `docker run -p 8080:80 ghcr.io/edeev/worldlang` (or `git.deev.su/edeev/worldlang`): nginx +serves the site and proxies the course API at `/api`; open http://localhost:8080. + ## License Coursework (Web Technologies Basics, Moscow Polytechnic University, 2025/26). The code is open for study; diff --git a/README.md b/README.md index f1aadda..bbcfe31 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ **Русский** · [English](README.en.md) [![CI](https://github.com/EDeev/worldlang/actions/workflows/ci.yml/badge.svg)](https://github.com/EDeev/worldlang/actions/workflows/ci.yml) +[![Release](https://img.shields.io/github/v/release/EDeev/worldlang)](https://github.com/EDeev/worldlang/releases) Экзаменационный проект по «Основам веб-технологий»: сайт онлайн-школы иностранных языков с каталогом курсов и репетиторов, заявками, личным кабинетом и картой учебных ресурсов на учебном API. @@ -28,6 +29,9 @@ Проверки: `node --check js/*.js` и `npx htmlhint *.html` (правила — в `.htmlhintrc`, их же гоняет CI). +**Docker:** готовый образ — `docker run -p 8080:80 ghcr.io/edeev/worldlang` (или `git.deev.su/edeev/worldlang`): nginx +отдаёт сайт и сам проксирует учебный API на `/api`, сайт откроется на http://localhost:8080. + ## Лицензия Учебный проект (Основы веб-технологий, Московский Политех, 2025/26). Код открыт для изучения, отдельной diff --git a/docker/nginx.conf b/docker/nginx.conf new file mode 100644 index 0000000..c9ebebf --- /dev/null +++ b/docker/nginx.conf @@ -0,0 +1,13 @@ +server { + listen 80; + root /usr/share/nginx/html; + index index.html; + + # учебный API под тем же адресом, что и сайт (как на lang.deev.su) + location /api/ { + resolver 1.1.1.1 8.8.8.8 valid=300s; + set $api exam-api-courses.std-900.ist.mospolytech.ru; + proxy_pass http://$api$request_uri; + proxy_set_header Host $api; + } +}