starfederation / datastar-restructure-interim

MIT License
9 stars 4 forks source link

Add Datastar Docker Dev back into the mix #25

Closed khalwat closed 1 week ago

khalwat commented 2 weeks ago

Adds Dockerized development environment for Datastar, with a CONTRIBUTING.md that outlines how to use it.

TODO: There should be a section added to CONTRITBUTING.md that outlines what needs to be installed, and how to work on Datastar if you do not want to do Dockerized development. I left this out because the old HACKING.md was out of date due to the new changes.

bencroker commented 2 weeks ago

When running make dev (on macOS) I get this error:

docker container run --rm -it -v "/Users/ben/Sites/datastar 2":/app -v go-modules:/go/pkg/mod --name datastar-dev-dev -e DEV_PORT="8080" -p 8080:8080 datastar-dev:1.23-alpine -c 'task -w site'
task: Started watching for tasks: site
task: [kill] fuser -k 4222/tcp > /dev/null 2>&1 || true
task: [css] ./twcli build -i site.css -o static/css/site.css
Cannot run macOS (Mach-O) executable in Docker: Exec format error
task: Task "templ" is up to date
task: [qtc] qtc
exit status 126

I ran into a similar issue when installing twcli and fixed it by replacing linux-x64 with macos-arm64. See the note I added to the Taskfile. https://github.com/starfederation/datastar/blob/d185a5a080ac266d4131426699366dd7ddbaccba/Taskfile.yml#L15-L16

khalwat commented 2 weeks ago

@bencroker I do not encounter that error on MacOS here.

Also, that error is the opposite of what you appear to be suggesting. It's saying that the MachO executable is inside of the Docker container rather than what it is expecting (the Linux executable).

Is it possible that you somehow left macos-arm64 in there when you shouldn't have at some point when the Docker image was built?

delaneyj commented 1 week ago

Unfortunately I hit errors

➜  khalwatdatastar git:(main) make dev
Error response from daemon: No such image: khalwatdatastar-dev:1.23-alpine
docker build -f Dockerfile-dev . -t khalwatdatastar-dev:1.23-alpine --build-arg TAG=1.23-alpine --no-cache
[+] Building 19.1s (7/7) FINISHED docker:default> sha256:c694 10.29kB / 10.29kB  0.0s
 => [internal] load build definition  0.0s
 => => transferring dockerfile: 579B  0.0s
 => [internal] load metadata for doc  1.2s
 => [internal] load .dockerignore     0.0s
 => => transferring context: 2B       0.0s
 => [1/3] FROM docker.io/library/gol  4.0s
 => => resolve docker.io/library/gol  0.0s
 => => sha256:c79b 74.04MB / 74.04MB  1.7s
 => => sha256:c694 10.29kB / 10.29kB  0.0s
 => => sha256:03bea3 1.92kB / 1.92kB  0.0s
 => => sha256:98069e 2.10kB / 2.10kB  0.0s
 => => sha256:da9db0 3.62MB / 3.62MB  0.5s
 => => sha256:54 290.88kB / 290.88kB  0.4s
 => => sha256:f115f9222c 126B / 126B  0.6s
 => => extracting sha256:da9db072f52  0.1s
 => => sha256:4f4fb700ef54 32B / 32B  0.7s
 => => extracting sha256:5418e60db87  0.0s
 => => extracting sha256:c79bddf330f  1.9s
 => => extracting sha256:f115f9222c8  0.0s
 => => extracting sha256:4f4fb700ef5  0.0s
 => [2/3] WORKDIR /app                0.1s
 => [3/3] RUN set -eux;     apk add  12.7s
 => exporting to image                1.0s
 => => exporting layers               0.9s
 => => writing image sha256:435b3058  0.0s
 => => naming to docker.io/library/k  0.0s
docker container run --rm -it -v "/home/delaney/repos/khalwatdatastar":/app -v go-modules:/go/pkg/mod --name khalwatdatastar-dev-image-build khalwatdatastar-dev:1.23-alpine -c 'git lfs fetch --all && git lfs pull && g
khalwat commented 1 week ago

@delaneyj not seeing any errors there?

This is expected:

Error response from daemon: No such image: khalwatdatastar-dev:1.23-alpine

It is checking to see if the image exists, and if not, automatically building it

bencroker commented 1 week ago

Is it possible that you somehow left macos-arm64 in there when you shouldn't have at some point when the Docker image was built?

That was it, thanks @khalwat.

khalwat commented 1 week ago

Fixed @delaneyj 's errors, and pushed the update to the PR

delaneyj commented 1 week ago

@khalwat is now a contrib, move work will happen on a feature branch going forward