Copy images instead of move to fix docker EXDEV error
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import type { ActionFunctionArgs } from "@remix-run/node";
|
||||
import { LoaderFunctionArgs, NodeOnDiskFile, json, redirect, unstable_composeUploadHandlers, unstable_createFileUploadHandler, unstable_createMemoryUploadHandler, unstable_parseMultipartFormData } from "@remix-run/node";
|
||||
import { renameSync, rmSync } from "node:fs";
|
||||
import { copyFileSync, rmSync } from "node:fs";
|
||||
import { useLoaderData } from "@remix-run/react";
|
||||
import { Container, Row, Button, Form, Image } from "react-bootstrap";
|
||||
|
||||
@@ -38,8 +38,9 @@ export const action = async ({
|
||||
// Remove old image
|
||||
if(beer.image) rmSync("public"+ beer.image, {force: true});
|
||||
|
||||
// Move the file to the beers folder with the slug as name
|
||||
renameSync(image.getFilePath(), "public" + newFilename);
|
||||
// Copy the file to the beers folder with the slug as name
|
||||
copyFileSync(image.getFilePath(), "public" + newFilename);
|
||||
rmSync(image.getFilePath(), {force: true});
|
||||
|
||||
await dbe.beer.update({data: {image: newFilename}, where: {id: id}});
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { ActionFunctionArgs } from "@remix-run/node";
|
||||
import { LoaderFunctionArgs, NodeOnDiskFile, json, redirect, unstable_composeUploadHandlers, unstable_createFileUploadHandler, unstable_createMemoryUploadHandler, unstable_parseMultipartFormData } from "@remix-run/node";
|
||||
import { renameSync, rmSync } from "node:fs";
|
||||
import { copyFileSync, rmSync } from "node:fs";
|
||||
import { useLoaderData } from "@remix-run/react";
|
||||
import { Container, Row, Button, Form, Image } from "react-bootstrap";
|
||||
|
||||
@@ -38,8 +38,9 @@ export const action = async ({
|
||||
// Remove old image
|
||||
if(cocktail.image) rmSync("public"+ cocktail.image, {force: true});
|
||||
|
||||
// Move the file to the cocktails folder with the slug as name
|
||||
renameSync(image.getFilePath(), "public" + newFilename);
|
||||
// Copy the file to the cocktails folder with the slug as name
|
||||
copyFileSync(image.getFilePath(), "public" + newFilename);
|
||||
rmSync(image.getFilePath(), {force: true});
|
||||
|
||||
await dbe.cocktail.update({data: {image: newFilename}, where: {id: id}});
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { ActionFunctionArgs } from "@remix-run/node";
|
||||
import { LoaderFunctionArgs, NodeOnDiskFile, json, redirect, unstable_composeUploadHandlers, unstable_createFileUploadHandler, unstable_createMemoryUploadHandler, unstable_parseMultipartFormData } from "@remix-run/node";
|
||||
import { renameSync, rmSync } from "node:fs";
|
||||
import { copyFileSync, rmSync } from "node:fs";
|
||||
import { useLoaderData } from "@remix-run/react";
|
||||
import { Container, Row, Button, Form, Image } from "react-bootstrap";
|
||||
|
||||
@@ -38,8 +38,9 @@ export const action = async ({
|
||||
// Remove old image
|
||||
if(manufacturer.image) rmSync("public"+ manufacturer.image, {force: true});
|
||||
|
||||
// Move the file to the manufacturers folder with the slug as name
|
||||
renameSync(image.getFilePath(), "public" + newFilename);
|
||||
// Copy the file to the manufacturers folder with the slug as name
|
||||
copyFileSync(image.getFilePath(), "public" + newFilename);
|
||||
rmSync(image.getFilePath(), {force: true});
|
||||
|
||||
await dbe.manufacturer.update({data: {image: newFilename}, where: {id: id}});
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { ActionFunctionArgs } from "@remix-run/node";
|
||||
import { LoaderFunctionArgs, NodeOnDiskFile, json, redirect, unstable_composeUploadHandlers, unstable_createFileUploadHandler, unstable_createMemoryUploadHandler, unstable_parseMultipartFormData } from "@remix-run/node";
|
||||
import { renameSync, rmSync } from "node:fs";
|
||||
import { copyFileSync, rmSync } from "node:fs";
|
||||
import { useLoaderData } from "@remix-run/react";
|
||||
import { Container, Row, Button, Form, Image } from "react-bootstrap";
|
||||
|
||||
@@ -38,8 +38,9 @@ export const action = async ({
|
||||
// Remove old image
|
||||
if(soda.image) rmSync("public"+ soda.image, {force: true});
|
||||
|
||||
// Move the file to the sodas folder with the slug as name
|
||||
renameSync(image.getFilePath(), "public" + newFilename);
|
||||
// Copy the file to the sodas folder with the slug as name
|
||||
copyFileSync(image.getFilePath(), "public" + newFilename);
|
||||
rmSync(image.getFilePath(), {force: true});
|
||||
|
||||
await dbe.soda.update({data: {image: newFilename}, where: {id: id}});
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { ActionFunctionArgs } from "@remix-run/node";
|
||||
import { LoaderFunctionArgs, NodeOnDiskFile, json, redirect, unstable_composeUploadHandlers, unstable_createFileUploadHandler, unstable_createMemoryUploadHandler, unstable_parseMultipartFormData } from "@remix-run/node";
|
||||
import { renameSync, rmSync } from "node:fs";
|
||||
import { copyFileSync, rmSync } from "node:fs";
|
||||
import { useLoaderData } from "@remix-run/react";
|
||||
import { Container, Row, Button, Form, Image } from "react-bootstrap";
|
||||
|
||||
@@ -38,8 +38,9 @@ export const action = async ({
|
||||
// Remove old image
|
||||
if(wine.image) rmSync("public"+ wine.image, {force: true});
|
||||
|
||||
// Move the file to the wines folder with the slug as name
|
||||
renameSync(image.getFilePath(), "public" + newFilename);
|
||||
// Copy the file to the wines folder with the slug as name
|
||||
copyFileSync(image.getFilePath(), "public" + newFilename);
|
||||
rmSync(image.getFilePath(), {force: true});
|
||||
|
||||
await dbe.wine.update({data: {image: newFilename}, where: {id: id}});
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { ActionFunctionArgs } from "@remix-run/node";
|
||||
import { LoaderFunctionArgs, NodeOnDiskFile, json, redirect, unstable_composeUploadHandlers, unstable_createFileUploadHandler, unstable_createMemoryUploadHandler, unstable_parseMultipartFormData } from "@remix-run/node";
|
||||
import { useLoaderData } from "@remix-run/react";
|
||||
import { renameSync, rmSync } from "node:fs";
|
||||
import { copyFileSync, rmSync } from "node:fs";
|
||||
import { useState } from "react";
|
||||
import { Button, Container, Form, InputGroup, Row } from "react-bootstrap";
|
||||
|
||||
@@ -53,7 +53,12 @@ export const action = async ({
|
||||
|
||||
try{
|
||||
// Move the file to the beers folder with the slug as name
|
||||
if(newFilename) renameSync(image.getFilePath(), "public" + newFilename);
|
||||
if(newFilename)
|
||||
{
|
||||
// Copy is required for docker container to work
|
||||
copyFileSync(image.getFilePath(), "public" + newFilename);
|
||||
rmSync(image.getFilePath(), {force: true});
|
||||
}
|
||||
|
||||
const createdBeer = await dbe.beer.create({ data: {
|
||||
slug: slug,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { ActionFunctionArgs } from "@remix-run/node";
|
||||
import { LoaderFunctionArgs, NodeOnDiskFile, json, redirect, unstable_composeUploadHandlers, unstable_createFileUploadHandler, unstable_createMemoryUploadHandler, unstable_parseMultipartFormData } from "@remix-run/node";
|
||||
import { useLoaderData } from "@remix-run/react";
|
||||
import { renameSync, rmSync } from "node:fs";
|
||||
import { copyFileSync, rmSync } from "node:fs";
|
||||
import { useState } from "react";
|
||||
import { Button, Container, Form, InputGroup, Row } from "react-bootstrap";
|
||||
|
||||
@@ -50,7 +50,12 @@ export const action = async ({
|
||||
|
||||
try{
|
||||
// Move the file to the beers folder with the slug as name
|
||||
if(newFilename) renameSync(image.getFilePath(), "public" + newFilename);
|
||||
if(newFilename)
|
||||
{
|
||||
// Copy is required for docker container to work
|
||||
copyFileSync(image.getFilePath(), "public" + newFilename);
|
||||
rmSync(image.getFilePath(), {force: true});
|
||||
}
|
||||
|
||||
const createdCocktail = await dbe.cocktail.create({ data: {
|
||||
slug: slug,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { ActionFunctionArgs } from "@remix-run/node";
|
||||
import { LoaderFunctionArgs, NodeOnDiskFile, json, redirect, unstable_composeUploadHandlers, unstable_createFileUploadHandler, unstable_createMemoryUploadHandler, unstable_parseMultipartFormData } from "@remix-run/node";
|
||||
import { renameSync, rmSync } from "node:fs";
|
||||
import { copyFileSync, rmSync } from "node:fs";
|
||||
import { useActionData, useLoaderData } from "@remix-run/react";
|
||||
import { Container, Row, Button, Form, Col, ListGroup } from "react-bootstrap";
|
||||
|
||||
@@ -34,7 +34,12 @@ export const action = async ({
|
||||
|
||||
try{
|
||||
// Move the file to the manufacturers folder with the slug as name
|
||||
if(newFilename) renameSync(image.getFilePath(), "public" + newFilename);
|
||||
if(newFilename)
|
||||
{
|
||||
// Copy is required for docker container to work
|
||||
copyFileSync(image.getFilePath(), "public" + newFilename);
|
||||
rmSync(image.getFilePath(), {force: true});
|
||||
}
|
||||
|
||||
const createdManufacturer = await dbe.manufacturer.create({ data: {name: name, description: description, image: newFilename, country: {connect: {code: country}}} });
|
||||
return redirect("/inventory/manufacturer/" + createdManufacturer.id);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { ActionFunctionArgs } from "@remix-run/node";
|
||||
import { LoaderFunctionArgs, NodeOnDiskFile, json, redirect, unstable_composeUploadHandlers, unstable_createFileUploadHandler, unstable_createMemoryUploadHandler, unstable_parseMultipartFormData } from "@remix-run/node";
|
||||
import { useLoaderData } from "@remix-run/react";
|
||||
import { renameSync, rmSync } from "node:fs";
|
||||
import { copyFileSync, rmSync } from "node:fs";
|
||||
import { useState } from "react";
|
||||
import { Button, Container, Form, InputGroup, Row } from "react-bootstrap";
|
||||
|
||||
@@ -50,7 +50,12 @@ export const action = async ({
|
||||
|
||||
try{
|
||||
// Move the file to the beers folder with the slug as name
|
||||
if(newFilename) renameSync(image.getFilePath(), "public" + newFilename);
|
||||
if(newFilename)
|
||||
{
|
||||
// Copy is required for docker container to work
|
||||
copyFileSync(image.getFilePath(), "public" + newFilename);
|
||||
rmSync(image.getFilePath(), {force: true});
|
||||
}
|
||||
|
||||
const createdSoda = await dbe.soda.create({ data: {
|
||||
slug: slug,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { ActionFunctionArgs } from "@remix-run/node";
|
||||
import { LoaderFunctionArgs, NodeOnDiskFile, json, redirect, unstable_composeUploadHandlers, unstable_createFileUploadHandler, unstable_createMemoryUploadHandler, unstable_parseMultipartFormData } from "@remix-run/node";
|
||||
import { useLoaderData } from "@remix-run/react";
|
||||
import { renameSync, rmSync } from "node:fs";
|
||||
import { copyFileSync, rmSync } from "node:fs";
|
||||
import { useState } from "react";
|
||||
import { Button, Container, Form, InputGroup, Row } from "react-bootstrap";
|
||||
|
||||
@@ -61,7 +61,12 @@ export const action = async ({
|
||||
|
||||
try{
|
||||
// Move the file to the wines folder with the slug as name
|
||||
if(newFilename) renameSync(image.getFilePath(), "public" + newFilename);
|
||||
if(newFilename)
|
||||
{
|
||||
// Copy is required for docker container to work
|
||||
copyFileSync(image.getFilePath(), "public" + newFilename);
|
||||
rmSync(image.getFilePath(), {force: true});
|
||||
}
|
||||
|
||||
const createdWine = await dbe.wine.create({ data: {
|
||||
slug: slug,
|
||||
|
||||
@@ -6,4 +6,9 @@ set -e
|
||||
npx zenstack generate
|
||||
npx remix vite:build
|
||||
|
||||
docker build -t beer-inventory .
|
||||
docker build -t gitea.furb.it/kennyboy55/beer-inventory:latest .
|
||||
|
||||
|
||||
## How to tag:
|
||||
# sudo docker build -t gitea.furb.it/kennyboy55/beer-inventory:latest .
|
||||
# sudo docker push gitea.furb.it/kennyboy55/beer-inventory:latest
|
||||
Reference in New Issue
Block a user