1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-22 02:12:40 +01:00

Add container image

This commit is contained in:
SupremeMortal 2024-09-14 22:14:29 +01:00
parent 224d4020d0
commit f889cbafbc
No known key found for this signature in database
5 changed files with 91 additions and 0 deletions

23
.dockerignore Normal file
View File

@ -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
.github/workflows/docker.yml vendored Normal file
View File

@ -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
.github/workflows/docker_dev.yml vendored Normal file
View File

@ -0,0 +1,12 @@
name: Docker Dev
on:
push:
branches: [ "master" ]
jobs:
docker:
uses: ./.github/workflows/docker.yml
with:
tag: dev
secrets: inherit

1
.gitignore vendored
View File

@ -11,6 +11,7 @@ config.json
assets/cacheMisses
.vscode/settings.json
.idea/
build

18
Containerfile Normal file
View File

@ -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"]