Skip to content
Closed
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
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ build
.idea
.env
.DS_Store
Dockerfile
61 changes: 24 additions & 37 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
name: Build & Deploy
name: Create and publish a Docker image

on:
push:
tags:
- v*
release:
types: [published]
workflow_dispatch:

# branches:
# - master
# - dev

# pull_request:
# branches:
# - main

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
TAG: ${{ github.ref_name }}

jobs:
# test:
Expand All @@ -35,38 +25,35 @@ jobs:
# run: docker compose run --build backend sh -c 'npx prisma migrate reset --force && export NODE_ENV=test && npx jest'

push:
timeout-minutes: 10
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# needs: test
# if: github.ref == 'refs/heads/main'

steps:
- name: Checkout
uses: actions/checkout@v3

- name: 'Login to GitHub Container Registry'
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ env.IMAGE_NAME }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{env.REGISTRY}}
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}

- name: Build containers
run: docker compose -f docker-compose.yml -f docker-compose.prod.yml build

- name: Add tag
run: docker tag ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{env.TAG}}

# - name: Add tag
# run: docker tag ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{github.sha}}

# - name: Tag with Git SHA
# run: docker tag ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{github.sha}}

- name: Push to Docker Hub
run: |
docker push ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{env.TAG}}
docker push ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest
password: ${{github.token}}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
FROM --platform=linux/amd64 node:18-alpine as pre-production

RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

#COPY . .
Expand All @@ -13,6 +12,10 @@ COPY backend/package-lock.json ./backend/package-lock.json

RUN npm i

# Add tini for better signal handling
RUN apk add --no-cache tini
ENTRYPOINT ["/sbin/tini", "--"]

RUN #npm ci --prefix backend --omit dev
RUN npm ci --prefix backend

Expand All @@ -25,6 +28,7 @@ FROM --platform=linux/amd64 node:18-alpine as production
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

ENV PORT=9494
ENV NODE_ENV=production

COPY --from=pre-production /usr/src/app/backend/dist ./dist
Expand Down
14 changes: 0 additions & 14 deletions docker-compose.override.yml

This file was deleted.

12 changes: 0 additions & 12 deletions docker-compose.prod.yml

This file was deleted.

11 changes: 0 additions & 11 deletions docker-compose.yml

This file was deleted.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"build:tizen": "set VITE_PLATFORM=tv&& vite build --mode production --outDir tizen/dist",
"preview": "vite preview",
"preview:tizen": "set VITE_PLATFORM=tv&& vite build --outDir tizen/dist && vite preview --outDir tizen/dist",
"deploy": "PORT=9494 NODE_ENV=production node build/",
"deploy": "NODE_ENV=production node build/",
"deploy:electron": "vite build && electron-builder -mw --x64 --config build.config.json; electron-builder -m --arm64 --config build.config.json",
"test": "playwright test",
"check": "svelte-check --tsconfig ./tsconfig.json",
Expand Down Expand Up @@ -72,4 +72,4 @@
"dependencies": {
"gsap": "^3.12.5"
}
}
}
8 changes: 7 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ export default defineConfig({
optimizeDeps: { exclude: ['svelte-navigator'] },
define: {
REIVERR_VERSION: `"${pkg.version}"`
}
},
server: {
port: Number(process.env.PORT || 4173)
},
preview: {
port: Number(process.env.PORT || 9494)
},

// base: '/dist',
// experimental: {
Expand Down