code change to work in Fly.io
This commit is contained in:
parent
cc7652fafe
commit
2e9b61353a
6 changed files with 131 additions and 3 deletions
26
.dockerignore
Normal file
26
.dockerignore
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
# flyctl launch added from .gitignore
|
||||||
|
# Logs
|
||||||
|
**\logs
|
||||||
|
**\*.log
|
||||||
|
**\npm-debug.log*
|
||||||
|
**\yarn-debug.log*
|
||||||
|
**\yarn-error.log*
|
||||||
|
**\pnpm-debug.log*
|
||||||
|
**\lerna-debug.log*
|
||||||
|
|
||||||
|
**\node_modules
|
||||||
|
**\dist
|
||||||
|
**\dist-ssr
|
||||||
|
**\*.local
|
||||||
|
|
||||||
|
# Editor directories and files
|
||||||
|
**\.vscode\*
|
||||||
|
!**\.vscode\extensions.json
|
||||||
|
**\.idea
|
||||||
|
**\.DS_Store
|
||||||
|
**\*.suo
|
||||||
|
**\*.ntvs*
|
||||||
|
**\*.njsproj
|
||||||
|
**\*.sln
|
||||||
|
**\*.sw?
|
||||||
|
fly.toml
|
||||||
18
.github/workflows/fly-deploy.yml
vendored
Normal file
18
.github/workflows/fly-deploy.yml
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
# See https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/
|
||||||
|
|
||||||
|
name: Fly Deploy
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
name: Deploy app
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
concurrency: deploy-group # optional: ensure only one action runs at a time
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: superfly/flyctl-actions/setup-flyctl@master
|
||||||
|
- run: flyctl deploy --remote-only
|
||||||
|
env:
|
||||||
|
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
|
||||||
27
Dockerfile
Normal file
27
Dockerfile
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
# Build Stage
|
||||||
|
FROM node:18 AS build
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY package*.json ./
|
||||||
|
RUN npm install
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# Serve Stage
|
||||||
|
FROM nginx:stable-alpine
|
||||||
|
|
||||||
|
# Copy built React files into nginx public folder
|
||||||
|
COPY --from=build /app/dist /usr/share/nginx/html
|
||||||
|
|
||||||
|
# Remove default nginx config
|
||||||
|
RUN rm /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
|
# Add your own nginx config
|
||||||
|
COPY nginx.conf /etc/nginx/conf.d
|
||||||
|
|
||||||
|
# Expose port 80
|
||||||
|
EXPOSE 80
|
||||||
|
|
||||||
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
42
fly.toml
Normal file
42
fly.toml
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
# fly.toml app configuration file generated for bytecamp-web on 2025-04-21T13:40:11-07:00
|
||||||
|
#
|
||||||
|
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
|
||||||
|
#
|
||||||
|
|
||||||
|
app = 'bytecamp-web'
|
||||||
|
primary_region = 'sea'
|
||||||
|
|
||||||
|
[build]
|
||||||
|
|
||||||
|
[env]
|
||||||
|
PORT = '8080'
|
||||||
|
|
||||||
|
[http_service]
|
||||||
|
internal_port = 80
|
||||||
|
force_https = true
|
||||||
|
auto_stop_machines = 'stop'
|
||||||
|
auto_start_machines = true
|
||||||
|
min_machines_running = 0
|
||||||
|
processes = ['app']
|
||||||
|
|
||||||
|
[[services]]
|
||||||
|
protocol = 'tcp'
|
||||||
|
internal_port = 8080
|
||||||
|
|
||||||
|
[[services.ports]]
|
||||||
|
port = 80
|
||||||
|
handlers = ['http']
|
||||||
|
|
||||||
|
[[services.ports]]
|
||||||
|
port = 443
|
||||||
|
handlers = ['tls', 'http']
|
||||||
|
|
||||||
|
[[services.tcp_checks]]
|
||||||
|
interval = '10s'
|
||||||
|
timeout = '2s'
|
||||||
|
grace_period = '5s'
|
||||||
|
|
||||||
|
[[vm]]
|
||||||
|
memory = '1gb'
|
||||||
|
cpu_kind = 'shared'
|
||||||
|
cpus = 1
|
||||||
11
nginx.conf
Normal file
11
nginx.conf
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name localhost;
|
||||||
|
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
index index.html;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri /index.html;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -14,6 +14,10 @@ function SignInForm() {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const googleAuth = () => {
|
||||||
|
window.open("https://byte-camp-auth-service.fly.dev/auth/google", "_self");
|
||||||
|
};
|
||||||
|
|
||||||
const handleOnSubmit = (evt) => {
|
const handleOnSubmit = (evt) => {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
|
|
||||||
|
|
@ -33,11 +37,11 @@ function SignInForm() {
|
||||||
<form onSubmit={handleOnSubmit}>
|
<form onSubmit={handleOnSubmit}>
|
||||||
<h1>Sign in</h1>
|
<h1>Sign in</h1>
|
||||||
<div className="social-container">
|
<div className="social-container">
|
||||||
<a href="#" className="social">
|
<a className="social" onClick={googleAuth}>
|
||||||
<i className="fab fa-facebook-f" />
|
<i className="fab fa-google-plus-g" />
|
||||||
</a>
|
</a>
|
||||||
<a href="#" className="social">
|
<a href="#" className="social">
|
||||||
<i className="fab fa-google-plus-g" />
|
<i className="fab fa-facebook-f" />
|
||||||
</a>
|
</a>
|
||||||
<a href="#" className="social">
|
<a href="#" className="social">
|
||||||
<i className="fab fa-linkedin-in" />
|
<i className="fab fa-linkedin-in" />
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue