diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..1cfcffe --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +.git +.github +docs +*.md +CNAME +.htaccess diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..740152b --- /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/web-tech + 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..61e2014 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +# Сайт курса «Основы веб-технологий» (лабораторные и задания) — статика за nginx +FROM nginx:1.27-alpine +COPY index.html /usr/share/nginx/html/ +COPY labs /usr/share/nginx/html/labs +COPY tasks /usr/share/nginx/html/tasks +EXPOSE 80 diff --git a/README.en.md b/README.en.md index e120795..65435af 100644 --- a/README.en.md +++ b/README.en.md @@ -3,6 +3,7 @@ [Русский](README.md) · **English** [![CI](https://github.com/EDeev/web-tech/actions/workflows/ci.yml/badge.svg)](https://github.com/EDeev/web-tech/actions/workflows/ci.yml) +[![Release](https://img.shields.io/github/v/release/EDeev/web-tech)](https://github.com/EDeev/web-tech/releases) Labs for the "Web Technologies Basics" course at Moscow Polytechnic University: from a first HTML page to the "EcoLunch" lunch delivery site with a menu, cart and orders through the course API. @@ -33,6 +34,9 @@ Polytech course API; the API key was issued by the course and lives in the lab c API data is escaped before being inserted into the page (the `esc()` function); CI checks the syntax of all scripts. +**Docker:** a prebuilt image with the site — `docker run -p 8080:80 ghcr.io/edeev/web-tech` (or `git.deev.su/edeev/web-tech`), +then open http://localhost:8080. + ## License Coursework (Web Technologies Basics, Moscow Polytechnic University, 2025). The code is open for study; diff --git a/README.md b/README.md index 9714b33..e21738b 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ **Русский** · [English](README.en.md) [![CI](https://github.com/EDeev/web-tech/actions/workflows/ci.yml/badge.svg)](https://github.com/EDeev/web-tech/actions/workflows/ci.yml) +[![Release](https://img.shields.io/github/v/release/EDeev/web-tech)](https://github.com/EDeev/web-tech/releases) Лабораторные по курсу «Основы веб-технологий» в Московском Политехе: от первой HTML-страницы до сайта сервиса доставки ланчей «ЭкоЛанч» с меню, корзиной и заказами через учебный API. @@ -33,6 +34,9 @@ Данные из API экранируются перед вставкой в страницу (функция `esc()`); CI проверяет синтаксис всех скриптов. +**Docker:** готовый образ с сайтом — `docker run -p 8080:80 ghcr.io/edeev/web-tech` (или `git.deev.su/edeev/web-tech`), +сайт откроется на http://localhost:8080. + ## Лицензия Учебный проект (Основы веб-технологий, Московский Политех, 2025). Код открыт для изучения, отдельной