add docker image

This commit is contained in:
hzrd149 2023-07-16 15:41:24 -05:00
parent 52d567c59b
commit 1afbe8562b
3 changed files with 55 additions and 0 deletions

View File

@ -0,0 +1,5 @@
---
"nostrudel": minor
---
Add docker image

41
.github/workflows/docker-image.yml vendored Normal file
View File

@ -0,0 +1,41 @@
name: Create and publish a Docker image
# copied from https://blog.pradumnasaraf.dev/publish-image-on-ghcr
on:
push:
branches: ["master"]
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@v3
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
labels: ${{ steps.meta.outputs.labels }}

9
dockerfile Normal file
View File

@ -0,0 +1,9 @@
# syntax=docker/dockerfile:1
FROM node:18
WORKDIR /app
COPY . /app/
RUN yarn install && yarn build
FROM nginx:stable-alpine-slim
EXPOSE 80
COPY --from=0 /app/dist /usr/share/nginx/html