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

[DevOps] Deploy to Fly.io #1657

Merged
merged 7 commits into from
Oct 26, 2023
Merged
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
34 changes: 34 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,27 @@
.npmrc
.husky
.travis.yml
greenkeeper.json

Check warning on line 11 in .dockerignore

View workflow job for this annotation

GitHub Actions / Cspell

Unknown word (greenkeeper)
docker-compose*.yml
*.md
.git/
.gitignore
Jenkinsfile

**/.next
**/build
**/node_modules/*
**/dist
**/out

**/*.log

**/.vscode
**/.env.local
**/.env*.local

fly.toml

node_modules

apps/mobile/node_modules
Expand All @@ -29,7 +43,7 @@
.idea
.vscode
.project
.classpath

Check warning on line 46 in .dockerignore

View workflow job for this annotation

GitHub Actions / Cspell

Unknown word (classpath)
*.launch
.settings/

Expand All @@ -40,3 +54,23 @@
#System Files
.DS_Store
Thumbs.db

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# vercel
.vercel

# typescript
*.tsbuildinfo

Check warning on line 72 in .dockerignore

View workflow job for this annotation

GitHub Actions / Cspell

Unknown word (tsbuildinfo)
next-env.d.ts

# Sentry Auth Token
.sentryclirc

Check warning on line 76 in .dockerignore

View workflow job for this annotation

GitHub Actions / Cspell

Unknown word (sentryclirc)
57 changes: 57 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# syntax = docker/dockerfile:1

# Adjust NODE_VERSION as desired
ARG NODE_VERSION=18.17.1
FROM node:${NODE_VERSION}-slim as base


# Next.js app lives here
WORKDIR /app

# Set production environment
ENV NEXT_SHARP_PATH=/app/node_modules/sharp


# Throw-away build stage to reduce size of final image
FROM base as build

# Install packages needed to build node modules
RUN apt-get update -qq && \
apt-get install -y build-essential pkg-config python-is-python3

# Install Yarn
RUN npm install -g yarn --force

# Install node modules
COPY --link package.json ./
COPY --link yarn.lock ./
COPY --link apps/web/package.json ./apps/web/package.json

RUN cd apps/web && \
yarn install --ignore-scripts

# Copy application code
COPY --link . .

ENV NODE_ENV="production"

# Build application
RUN yarn run build:web

# Remove development dependencies
RUN cd apps/web && \
yarn install --prod --ignore-scripts


# Final stage for app image
FROM base

ENV NODE_ENV="production"

# Copy built application
COPY --from=build /app /app

# Start the server by default, this can be overwritten at runtime
EXPOSE 3000

CMD [ "npm", "run", "start:web" ]
13 changes: 10 additions & 3 deletions apps/web/next.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
const path = require('path');

// eslint-disable-next-line @typescript-eslint/no-var-requires
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
webpack: (config, { isServer }) => {
config.resolve.alias['@app'] = path.join(__dirname, 'app');
config.resolve.alias['@components'] = path.join(__dirname, 'components');
config.resolve.alias['app'] = path.join(__dirname, 'app');
config.resolve.alias['components'] = path.join(__dirname, 'components');
config.resolve.alias['lib'] = path.join(__dirname, 'lib');
return config;
},
images: {
domains: [
'dummyimage.com',
Expand All @@ -14,9 +24,6 @@ const nextConfig = {
'apistage.gauzy.co',
'gauzy.s3.wasabisys.com'
]
},
experimental: {
evereq marked this conversation as resolved.
Show resolved Hide resolved
appDir: true
}
};

Expand Down
1 change: 1 addition & 0 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
"react-popper": "^2.3.0",
"react-popper-tooltip": "^4.4.2",
"recoil": "^0.7.7",
"sharp": "^0.32.6",
"slate": "^0.90.0",
"slate-history": "^0.93.0",
"slate-hyperscript": "^0.77.0",
Expand Down
19 changes: 19 additions & 0 deletions fly.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# fly.toml app configuration file generated for ever-teams on 2023-10-26T08:19:45Z
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = "ever-teams"
primary_region = "lax"
kill_signal = "SIGINT"
kill_timeout = "5m0s"

[build]
evereq marked this conversation as resolved.
Show resolved Hide resolved

[http_service]
internal_port = 3000
force_https = true
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0
processes = ["app"]
Loading
Loading