Skip to content

Commit

Permalink
Merge pull request #2 from patrickbaber/main
Browse files Browse the repository at this point in the history
Docker build
  • Loading branch information
janthurau authored Jan 23, 2024
2 parents 141797c + 834e47d commit a0144c4
Show file tree
Hide file tree
Showing 5 changed files with 68 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 @@
.git
*.md
31 changes: 31 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: build

on:
push:
branches:
- "main"

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ secrets.CONTAINER_IMAGE }}
secrets: |
"npmrc=${{ secrets.NPMRC }}"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ node_modules
dist
dist-ssr
*.local
.npmrc

# Editor directories and files
@hocuspocus/provider-demos/.vscode/extensions.json
Expand Down
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM node:20-bookworm-slim AS builder
LABEL maintainer "Patrick Baber <patrick.baber@tiptap.dev>"

# Upgrade Debian packages
RUN apt-get update \
&& apt-get upgrade -y --no-install-recommends \
&& rm -r /var/lib/apt/lists/*

# Copy files
COPY . /var/www
WORKDIR /var/www/

# Install NPM packages
RUN --mount=type=secret,id=npmrc,target=/var/www/.npmrc,required=true \
npm install \
&& npm run build

FROM nginx:1.25

COPY --from=builder /var/www/dist /usr/share/nginx/html
14 changes: 14 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: "3.9"

services:
app:
build:
context: .
secrets:
- npmrc
ports:
- "80:80"

secrets:
npmrc:
file: .npmrc

0 comments on commit a0144c4

Please sign in to comment.