Merge pull request 'Build Docker image in CI' (#1) from docker-build into main
All checks were successful
Build Nginx-based docker image / build-static-assets (push) Successful in 4m32s

Reviewed-on: #1
This commit is contained in:
bustikiller 2024-11-16 13:02:02 +00:00
commit f24b76a6fa
2 changed files with 46 additions and 0 deletions

View File

@ -0,0 +1,33 @@
name: Build Nginx-based docker image
on:
push:
branches:
- main
pull_request:
jobs:
build-static-assets:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to the private Docker registry
uses: docker/login-action@v3
with:
registry: ${{ secrets.PRIVATE_REGISTRY_HOST }}
username: ${{ secrets.PRIVATE_REGISTRY_USERNAME }}
password: ${{ secrets.PRIVATE_REGISTRY_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: |
${{ secrets.PRIVATE_REGISTRY_HOST }}/${{ env.GITHUB_REPOSITORY }}:latest
cache-from: type=registry,ref=user/app:latest
cache-to: type=inline

13
Dockerfile Normal file
View File

@ -0,0 +1,13 @@
FROM node:23 AS build
ENV FORCE_COLOR=0
RUN corepack enable
WORKDIR /opt/docusaurus
WORKDIR /opt/docusaurus
COPY . /opt/docusaurus/
RUN npm ci
RUN npm run build
FROM nginx:alpine
COPY --from=build /opt/docusaurus/build /usr/share/nginx/html
EXPOSE 80