Skip to content

Commit

Permalink
Publish docker images
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry2080 committed Nov 11, 2024
1 parent 38e14fe commit 9d467ed
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.github
.gitignore
46 changes: 46 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Create and publish Docker image

on:
push:
branches: ['main']
paths-ignore:
- LICENSE
- README.md
- .gitignore

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

concurrency:
group: "docker-publish"
cancel-in-progress: true

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
pull: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea
.DS_Store
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM nginx:stable-alpine

WORKDIR /dist

COPY /dist /usr/share/nginx/html
RUN rm -rf /dist

CMD ["/entrypoint.sh"]
14 changes: 14 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh

ECONUMO_CONFIG_API_URL="${ECONUMO_CONFIG_API_URL:=}"
LILTAG_CONFIG_URL="${LILTAG_CONFIG_URL:=}"
LILTAG_CACHE_TTL="${LILTAG_CACHE_TTL:=0}"
echo "window.econumoConfig = {
API_URL: \"${ECONUMO_CONFIG_API_URL}\",
LILTAG_CONFIG_URL: \"${LILTAG_CONFIG_URL}\",
LILTAG_CACHE_TTL: ${LILTAG_CACHE_TTL},
}" > /usr/share/nginx/html/econumo-config.js


# Запуск Nginx
nginx -g "daemon off;"

0 comments on commit 9d467ed

Please sign in to comment.