-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(deployment): add deploy.yml for GitHub Actions and Dockerfile
- Loading branch information
Showing
7 changed files
with
1,083 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Build & Deploy | ||
|
||
on: | ||
push: | ||
branches: ['233-migrate-to-remix'] | ||
|
||
pull_request: | ||
branches: ['233-migrate-to-remix'] | ||
|
||
jobs: | ||
build-and-deploy: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [20.x] | ||
|
||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'npm' | ||
- run: npm ci | ||
- run: npx nx build web | ||
- run: npm run build --if-present | ||
|
||
- uses: a7ul/tar-action@v1.1.0 | ||
with: | ||
command: c | ||
cwd: './' | ||
files: | | ||
dist/apps/web/ | ||
outPath: deploy.tar | ||
|
||
- name: Deploy App to CapRover | ||
uses: caprover/deploy-from-github@v1.0.1 | ||
with: | ||
server: '${{ secrets.CAPROVER_SERVER }}' | ||
app: '${{ secrets.APP_NAME }}' | ||
token: '${{ secrets.APP_TOKEN }}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
FROM node:20.16.0-alpine | ||
|
||
# Set working directory | ||
WORKDIR /app | ||
|
||
# Copy build files | ||
COPY build/client ./client | ||
COPY build/server ./server | ||
|
||
# Create server.js file | ||
RUN echo "import { createRequestHandler } from '@remix-run/express'; \ | ||
import express from 'express'; \ | ||
import * as build from './server/index.js'; \ | ||
\ | ||
const app = express(); \ | ||
const port = process.env.PORT || 3380; \ | ||
\ | ||
app.use(express.static('./client')); \ | ||
\ | ||
app.all( \ | ||
'*', \ | ||
createRequestHandler({ \ | ||
build, \ | ||
}), \ | ||
); \ | ||
\ | ||
app.listen(port, () => { \ | ||
console.log(\`Server is running on port \${port}\`); \ | ||
});" > server.js | ||
|
||
# Copy package files | ||
COPY build/server/package.json ./ | ||
|
||
# Install production dependencies only | ||
RUN npm install | ||
|
||
# Expose port from environment variable with fallback | ||
EXPOSE 3380 | ||
|
||
# Start the server | ||
CMD ["node", "server.js"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"schemaVersion": 2, | ||
"dockerfilePath": "./apps/web/Dockerfile" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.