Skip to content

Commit 8499c7d

Browse files
committed
fix deployment for file move
1 parent 3500df1 commit 8499c7d

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

docs/deployment.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,28 @@ Every commit to your `main` branch will trigger a deployment to your production
9898
environment, and every commit to your `dev` branch will trigger a deployment to
9999
your staging environment.
100100

101+
## Deploying locally
102+
103+
If you'd like to deploy locally you definitely can. You need to (temporarily)
104+
move the `Dockerfile` and the `.dockerignore` to the root of the project first.
105+
Then you can run the deploy command:
106+
107+
```
108+
mv ./other/Dockerfile Dockerfile
109+
mv ./other/dockerignore .dockerignore
110+
fly deploy
111+
```
112+
113+
Once it's done, move the files back:
114+
115+
```
116+
mv Dockerfile ./other/Dockerfile
117+
mv .dockerignore ./other/.dockerignore
118+
```
119+
120+
You can keep the `Dockerfile` and `.dockerignore` in the root if you prefer,
121+
just make sure to remove the move step from the `.github/workflows/deploy.yml`.
122+
101123
## Connecting to your database
102124

103125
The sqlite database lives at `/data/sqlite.db` in the deployed application.

remix.init/index.mjs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,21 @@ async function setupDeployment({ rootDirectory }) {
179179
name: 'shouldDeploy',
180180
type: 'confirm',
181181
default: true,
182-
message: 'Would you like to deploy right now?',
182+
message:
183+
'Would you like to deploy right now? (This will take a while, and you can always wait until you push to GitHub instead).',
183184
},
184185
])
185186
if (shouldDeploy) {
186187
console.log(`🚀 Deploying apps...`)
188+
console.log(' Moving Dockerfile and .dockerignore to root (temporarily)')
189+
await fs.rename(
190+
path.join(rootDirectory, 'other', 'Dockerfile'),
191+
path.join(rootDirectory, 'Dockerfile'),
192+
)
193+
await fs.rename(
194+
path.join(rootDirectory, 'other', '.dockerignore'),
195+
path.join(rootDirectory, '.dockerignore'),
196+
)
187197
console.log(` Starting with staging`)
188198
await $I`fly deploy --app ${APP_NAME}-staging`
189199
// "fly open" was having trouble with opening the staging app
@@ -194,6 +204,15 @@ async function setupDeployment({ rootDirectory }) {
194204
await $I`fly deploy --app ${APP_NAME}`
195205
await $I`open https://${APP_NAME}.fly.dev/`
196206
console.log(` Production deployed...`)
207+
console.log(' Moving Dockerfile and .dockerignore back to other/')
208+
await fs.rename(
209+
path.join(rootDirectory, 'Dockerfile'),
210+
path.join(rootDirectory, 'other', 'Dockerfile'),
211+
)
212+
await fs.rename(
213+
path.join(rootDirectory, '.dockerignore'),
214+
path.join(rootDirectory, 'other', '.dockerignore'),
215+
)
197216
}
198217

199218
const { shouldSetupGitHub } = await inquirer.prompt([

0 commit comments

Comments
 (0)