Skip to content

Commit

Permalink
chore: dockerize (#21)
Browse files Browse the repository at this point in the history
* chore: dockerize

* chore: edit Dockerfile

* chore: update tag

---------

Co-authored-by: Leon Hudak <33522493+leohhhn@users.noreply.github.com>
  • Loading branch information
albttx and leohhhn authored Apr 26, 2024
1 parent a7d1e0c commit bd06e5d
Show file tree
Hide file tree
Showing 5 changed files with 127 additions and 5 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: docker

on:
push:
branches:
- "main"
tags:
- "v*"

jobs:
docker-dev:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

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

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=raw,value=dev
type=semver,pattern=v{{version}}-dev
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
file: "./Dockerfile"
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

docker-production:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

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

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=raw,value=latest
type=semver,pattern=v{{version}}
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
file: "./Dockerfile.production"
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
5 changes: 0 additions & 5 deletions .github/workflows/netlify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ on:
branches:
- main

env:
MEILISEARCH_URL: ${{ secrets.MEILISEARCH_URL }}
MEILISEARCH_API_KEY: ${{ secrets.MEILISEARCH_API_KEY }}
MEILISEARCH_INDEX_UID: ${{ secrets.MEILISEARCH_INDEX_UID}}

jobs:
deploy-netlify:
name: deploy-to-netlify
Expand Down
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM node:18.18.0-alpine3.18 as build

WORKDIR /app

COPY . .

RUN rm -rf build docs

WORKDIR /app/docusaurus

RUN yarn install

CMD [ "yarn", "start", "--host=0.0.0.0" ]
14 changes: 14 additions & 0 deletions Dockerfile.production
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM node:18.18.0-alpine3.18 as build

WORKDIR /app

COPY . .

WORKDIR /app/docusaurus

RUN yarn install
RUN yarn build

FROM nginx:stable-alpine

COPY --from=build /app/docusaurus/build /usr/share/nginx/html/
29 changes: 29 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: "3"

services:
docusaurus:
image: ghcr.io/gnolang/docs.gno.land:dev
build:
context: .
volumes:
- .:/app/docs
ports:
- 3000:3000
environment:
- MEILISEARCH_URL="localhost:7700"
- MEILISEARCH_API_KEY="masterKey"
- MEILISEARCH_INDEX_UID="dev"

meilisearch:
image: getmeili/meilisearch
restart: unless-stopped
environment:
- MEILI_MASTER_KEY=masterKey
- MEILI_NO_ANALYTICS=true
- MEILI_ENV=dev
- MEILI_LOG_LEVEL=info
- MEILI_DB_PATH=/data.ms
ports:
- 7700:7700
#volumes:
# - ./data.ms:/data.ms

0 comments on commit bd06e5d

Please sign in to comment.