Skip to content

Commit

Permalink
Build docker image and push to ghcr
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelMwangiW committed Mar 18, 2024
1 parent b27e1bc commit 94c78a0
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/build-docs-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build Docs Image & Deploy to GHCR

on:
push:
branches:
- main
- add-docs
workflow_dispatch:

jobs:
push-store-image:
runs-on: ubuntu-latest
defaults:
run:
working-directory: './docs'
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@main

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/samuelmwangiw/at-laravel-docs:latest
18 changes: 18 additions & 0 deletions docs/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM node:lts-alpine as build

WORKDIR /app

COPY . .

RUN apk add --no-cache git && \
npm ci && \
npm run docs:build

FROM nginx:stable-alpine

LABEL org.opencontainers.image.source="https://github.com/SamuelMwangiW/africastalking-laravel"
LABEL org.opencontainers.image.licenses="MIT"

COPY --from=build /app/.vitepress/dist /usr/share/nginx/html

EXPOSE 80

0 comments on commit 94c78a0

Please sign in to comment.