Skip to content

Commit fd71684

Browse files
committed
first commit
0 parents  commit fd71684

16 files changed

+21799
-0
lines changed

.eslintrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": ["@remix-run/eslint-config", "@remix-run/eslint-config/node"]
3+
}

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules
2+
3+
/.cache
4+
/build
5+
/public/build
6+
.env

Dockerfile

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# # base node image
2+
FROM node:16-bullseye-slim as base
3+
ARG REMIX_TOKEN
4+
ENV REMIX_TOKEN=${REMIX_TOKEN}
5+
6+
# # Build the dev image
7+
FROM base as build
8+
RUN mkdir /app/
9+
WORKDIR /app/
10+
COPY . /app
11+
RUN npm install
12+
RUN npm run build
13+
14+
# # Get the production modules
15+
FROM base as production-deps
16+
RUN mkdir /app/
17+
WORKDIR /app/
18+
COPY --from=build /app/node_modules /app/node_modules
19+
ADD package.json package-lock.json .npmrc /app/
20+
RUN npm prune --production
21+
22+
# Pull out the build files and do a production install
23+
FROM base
24+
ENV NODE_ENV=production
25+
RUN mkdir /app/
26+
WORKDIR /app/
27+
ADD package.json package-lock.json .npmrc /app/
28+
COPY --from=build /app/public /app/public
29+
COPY --from=build /app/server /app/server
30+
COPY --from=production-deps /app/node_modules /app/node_modules
31+
CMD ["node", "server/index.js"]

README.md

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Welcome to Remix!
2+
3+
- [Remix Docs](https://remix.run/docs)
4+
5+
## Development
6+
7+
From your terminal:
8+
9+
```sh
10+
npm run dev
11+
```
12+
13+
This starts your app in development mode, rebuilding assets on file changes.
14+
15+
## Deployment
16+
17+
First, build your app for production:
18+
19+
```sh
20+
npm run build
21+
```
22+
23+
Then run the app in production mode:
24+
25+
```sh
26+
npm start
27+
```
28+
29+
Now you'll need to pick a host to deploy it to.
30+
31+
### DIY
32+
33+
If you're familiar with deploying node applications, the built-in Remix app server is production-ready.
34+
35+
Make sure to deploy the output of `remix build`
36+
37+
- `build/`
38+
- `public/build/`
39+
40+
### Using a Template
41+
42+
When you ran `npx create-remix@latest` there were a few choices for hosting. You can run that again to create a new project, then copy over your `app/` folder to the new project that's pre-configured for your target server.
43+
44+
```sh
45+
cd ..
46+
# create a new project, and pick a pre-configured host
47+
npx create-remix@latest
48+
cd my-new-remix-app
49+
# remove the new project's app (not the old one!)
50+
rm -rf app
51+
# copy your app over
52+
cp -R ../my-old-remix-app/app app
53+
```

app/entry.client.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { RemixBrowser } from "@remix-run/react";
2+
import { hydrateRoot } from "react-dom/client";
3+
4+
hydrateRoot(document, <RemixBrowser />);

app/entry.server.tsx

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import { PassThrough } from "stream";
2+
import type { EntryContext } from "@remix-run/node";
3+
import { Response } from "@remix-run/node";
4+
import { RemixServer } from "@remix-run/react";
5+
import { renderToPipeableStream } from "react-dom/server";
6+
7+
const ABORT_DELAY = 5000;
8+
9+
export default function handleRequest(
10+
request: Request,
11+
responseStatusCode: number,
12+
responseHeaders: Headers,
13+
remixContext: EntryContext
14+
) {
15+
return new Promise((resolve, reject) => {
16+
let didError = false;
17+
18+
const { pipe, abort } = renderToPipeableStream(
19+
<RemixServer context={remixContext} url={request.url} />,
20+
{
21+
onShellReady: () => {
22+
const body = new PassThrough();
23+
24+
responseHeaders.set("Content-Type", "text/html");
25+
26+
resolve(
27+
new Response(body, {
28+
headers: responseHeaders,
29+
status: didError ? 500 : responseStatusCode,
30+
})
31+
);
32+
33+
pipe(body);
34+
},
35+
onShellError: (err) => {
36+
reject(err);
37+
},
38+
onError: (error) => {
39+
didError = true;
40+
41+
console.error(error);
42+
},
43+
}
44+
);
45+
46+
setTimeout(abort, ABORT_DELAY);
47+
});
48+
}

app/root.tsx

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import type { MetaFunction } from "@remix-run/node";
2+
import {
3+
Links,
4+
LiveReload,
5+
Meta,
6+
Outlet,
7+
Scripts,
8+
ScrollRestoration,
9+
} from "@remix-run/react";
10+
11+
export const meta: MetaFunction = () => ({
12+
charset: "utf-8",
13+
title: "New Remix App",
14+
viewport: "width=device-width,initial-scale=1",
15+
});
16+
17+
export default function App() {
18+
return (
19+
<html lang="en">
20+
<head>
21+
<Meta />
22+
<Links />
23+
</head>
24+
<body>
25+
<Outlet />
26+
<ScrollRestoration />
27+
<Scripts />
28+
<LiveReload />
29+
</body>
30+
</html>
31+
);
32+
}

app/routes/index.tsx

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
export default function Index() {
2+
return (
3+
<div style={{ fontFamily: "system-ui, sans-serif", lineHeight: "1.4" }}>
4+
<h1>Welcome to Remix</h1>
5+
<ul>
6+
<li>
7+
<a
8+
target="_blank"
9+
href="https://remix.run/tutorials/blog"
10+
rel="noreferrer"
11+
>
12+
15m Quickstart Blog Tutorial
13+
</a>
14+
</li>
15+
<li>
16+
<a
17+
target="_blank"
18+
href="https://remix.run/tutorials/jokes"
19+
rel="noreferrer"
20+
>
21+
Deep Dive Jokes App Tutorial
22+
</a>
23+
</li>
24+
<li>
25+
<a target="_blank" href="https://remix.run/docs" rel="noreferrer">
26+
Remix Docs
27+
</a>
28+
</li>
29+
</ul>
30+
</div>
31+
);
32+
}

cloudbuild.yaml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
steps:
2+
# Build the container image
3+
- name: "gcr.io/cloud-builders/docker"
4+
args:
5+
[
6+
"build",
7+
"-t",
8+
"gcr.io/$PROJECT_ID/$_SERVICE_NAME:$COMMIT_SHA",
9+
"--build-arg",
10+
"REMIX_TOKEN=$_REMIX_TOKEN",
11+
"."
12+
]
13+
- name: 'gcr.io/cloud-builders/docker'
14+
args: ['push', 'gcr.io/$PROJECT_ID/$_SERVICE_NAME:$COMMIT_SHA']
15+
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
16+
entrypoint: gcloud
17+
args: ['run', 'deploy', '$_SERVICE_NAME', '--image', 'gcr.io/$PROJECT_ID/$_SERVICE_NAME:$COMMIT_SHA', '--region', '$_DEPLOY_REGION']
18+
images: [
19+
"gcr.io/$PROJECT_ID/$_SERVICE_NAME:$COMMIT_SHA"
20+
]

firebase.json

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"hosting": [
2+
{
3+
"site": "bldgforum-gcloud",
4+
"public": "public",
5+
"ignore": [
6+
"firebase.json",
7+
"**/.*",
8+
"**/node_modules/**"
9+
],
10+
"rewrites": [
11+
{
12+
"source": "**",
13+
"run": {
14+
"serviceId": "bldgforum-gcloud"
15+
}
16+
}
17+
]
18+
}
19+
],

0 commit comments

Comments
 (0)