Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add container image #1216

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**/.DS_STORE
db/
dist/
node_modules
database.db
tsconfig.tsbuildinfo
files/
assets/cache
.env
config.json
assets/cacheMisses

.vscode/settings.json
.idea/

build

*.log
*.log.ansi
*.tmp
tmp/
dump/
result
37 changes: 37 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Docker

on:
workflow_call:
inputs:
tag:
type: string
required: true
description: 'The tag to use for the Docker image'

env:
REGISTRY: ghcr.io

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Lowercase repository name
run: |
echo "IMAGE_NAME=${OWNER,,}" >>${GITHUB_ENV}
env:
OWNER: '${{ github.repository }}'
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v6
with:
context: .
file: Containerfile
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ inputs.tag }}
12 changes: 12 additions & 0 deletions .github/workflows/docker_dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Docker Dev

on:
push:
branches: [ "master" ]

jobs:
docker:
uses: ./.github/workflows/docker.yml
with:
tag: dev
secrets: inherit
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ config.json
assets/cacheMisses

.vscode/settings.json
.idea/

build

Expand Down
18 changes: 18 additions & 0 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM quay.io/sclorg/nodejs-20-minimal-c9s:latest AS builder

USER root

COPY . /opt/app-root/src

RUN npm install --prefix /opt/app-root/src && \
npm run build --prefix /opt/app-root/src && \
npm run setup

FROM quay.io/sclorg/nodejs-20-minimal-c9s:latest

COPY --from=builder /opt/app-root/src/node_modules /opt/app-root/src/node_modules
COPY --from=builder /opt/app-root/src/dist /opt/app-root/src/dist
COPY --from=builder /opt/app-root/src/assets /opt/app-root/src/assets
COPY --from=builder /opt/app-root/src/package.json /opt/app-root/src/package.json

CMD ["node", "/opt/app-root/src/dist/bundle/start.js"]