Comments (10)
Does this work with the stock create-react-app
(in JS)?
from reason-scripts.
Hi @portenez, thanks for filing this issue!
Could you please paste the full output of the error logs? I don't know if any of the maintainers here use Docker, and installing it to debug this issue would be a serious time commitment from us. Additionally, pasting the error logs could give us a lot for information and we can tell if it's a known issue from Reason, or from the upstream create-react-app.
I also recommend searching the create-react-app repo for more information on using it with Docker.
Thanks again!
from reason-scripts.
Create react app does work. I have another project with a similar setup (create react app) , but no reasonml. that one work just fine. I'll double check versions and post a dockerfile for that one (just create react app) as soon as I have a chance. How do I enable the debug logs? I'll post them here.
from reason-scripts.
You said the “start” command fails? What do yoya mean by fails? This is a difficult and time consuming set up to replicate, so we would appreciate knowing how it fails, there may be a different error than just running it in docket.
from reason-scripts.
Create React App versions
working = YES
Version 1 with npx
FROM node:9-alpine
RUN addgroup -S app && adduser -S -G app app
USER app
RUN mkdir ~/.npm-global
RUN npm config set prefix '~/.npm-global'
ENV PATH=~/.npm-global/bin:$PATH
RUN cd ~ \
&& npx create-react-app my-app
WORKDIR /home/app/my-app
Version 2 with yarn
FROM node:9-alpine
RUN addgroup -S app && adduser -S -G app app
USER app
RUN mkdir ~/.npm-global
RUN npm config set prefix '~/.npm-global'
ENV PATH=~/.npm-global/bin:$PATH
RUN cd ~ \
&& yarn create react-app my-app
WORKDIR /home/app/my-app
To run
- Create a
Dockerfile
with the code above - Build image using the Dockerfile. e.g.:
docker build . -t happy-js
- yarn start succeeds. try by:
docker run --rm -it happy-js yarn start
- yarn build fails. try by:
docker run --rm -it happy-js yarn build
Sample succesful output:
docker run --rm -it happy-js yarn build 8s 148ms
yarn run v1.5.1
$ react-scripts build
Creating an optimized production build...
Compiled successfully.
File sizes after gzip:
36.94 KB build/static/js/main.a0b7d8d3.js
299 B build/static/css/main.c17080f1.css
The project was built assuming it is hosted at the server root.
You can control this with the homepage field in your package.json.
For example, add this to build it for GitHub Pages:
"homepage" : "http://myname.github.io/myapp",
The build folder is ready to be deployed.
You may serve it with a static server:
yarn global add serve
serve -s build
Find out more about deployment here:
http://bit.ly/2vY88Kr
Done in 9.46s.
from reason-scripts.
@rrdelaney I updated the original ticket with the output that I'm getting.
More than docker, looks like a Linux issue. To replicate any of the scenarios pretty much these are the steps:
- Get/install docker: https://www.docker.com/docker-mac
- In a dir touch
Dockerfile
, and add the contents of any of my examples. At this point you have docker + the Dockefile with the instructions on how to create the container. - Build the container by calling docker build in the same dir as the
Dockerfile
docker build . -t ${tagUseAsRefToRun}
. - Run the built container by using docker run:
docker run --rm -it ${tagUseAsRefToRun} ${comandsToExecute}
.
So for example
mkdir dockerTest
cd dockerTest
touch Dockerfile
vim Dockerfile #here paste the contents
docker build . -t test-container
docker run --rm -it test-container yarn start # the last tokens in the cli are passed to the container
#or
docker run --rm -it test-container yarn build
An alternative way to reproduce it is to just open a terminal in node:9-alpine and type all the commands in there. More difficult IMO.
You could start such terminal by:
docker run --rm -it node:9-alpine /bin/ash
Which will give you a completely clean node:9-alpine container
from reason-scripts.
It looks like Alpine Linux doesn’t have the script command. reason-scripts running on Linux system requires that command to be present.
Please see rrdelaney/bs-loader#35 and gliderlabs/docker-alpine#160 for more information.
from reason-scripts.
I see, that's a shame. I guess I'm going to try using debían instead. Thanks for the help.
Perhaps, it'd be useful to have some Linux info in the docs. Or maybe I missed it?
from reason-scripts.
As reference, xenial
based container did work just fine:
FROM ubuntu:xenial
RUN apt-get update \
&& apt-get install -y curl \
build-essential \
git \
&& apt-get clean \
&& apt-get autoremove --purge
RUN curl -sL https://deb.nodesource.com/setup_9.x | bash - \
&& apt-get install -y nodejs \
&& apt-get clean
RUN npm install -g yarn
RUN yarn add global [email protected]
RUN yarn add global bs-platform
RUN mkdir -p /opt \
&& yarn create react-app my-app --scripts-version reason-scripts \
&& cd my-app
WORKDIR /opt/my-app
CMD ["yarn", "start"]
build contianerdocker build . -t reason-builder
serve docker run --rm -it reason-builder
build assets docker run --rm -it reson-builder yarn build
from reason-scripts.
@portenez I just ran into this myself and apk add util-linux
adds script
for me. Perhaps that's an alternative for you if you wanna get a slimmer container.
from reason-scripts.
Related Issues (20)
- yarn start is not showing errors from bsb HOT 2
- Syntax error with fresh app HOT 4
- Get SyntaxError from bs-loader HOT 3
- yarn build succeeds even with broken App.re HOT 12
- Tests are broken HOT 1
- Doesn't work the first time HOT 2
- Need to run `npm install` after create-react-app has run when using npm HOT 2
- Default import not working? HOT 3
- Test Not Running Immediate After create-app HOT 2
- webpack uses ES6 and not umd/commonJS HOT 8
- Unexpected error. Please report it as a bug: ~ Creating in a mono Repo HOT 2
- missing part of the error message at terminal HOT 2
- Fails to build after creating HOT 1
- Compiler runs on an infinite loop when component is on subfolder HOT 6
- Default Tests Not Found HOT 4
- bsb.exe: unknown option '-color'. HOT 1
- New Project Failed to Compile Error HOT 4
- Use `App.re` instead of `app.re` HOT 1
- BS Compiler stuck HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reason-scripts.