Open seba4316 opened 4 months ago
Hey @seba4316 ever since Heroku reduced their free tier over a year ago, I have not been hosting there anymore. It is currently not hosted anywhere.
If you'd like to try and run it yourself, you can try and run the dev dockerfile, which will build all the containers locally. I cannot promise this will work as I haven't touched this code in quite some time.
Tried running docker compose -f docker-compose-dev.yaml build
but this is what I get:
[+] Building 3.5s (17/23)
=> [go-poker-go-poker internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [go-poker-go-poker internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 285B 0.0s
=> [go-poker-go-poker-web internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 1.35kB 0.0s
=> [go-poker-go-poker-web internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [go-poker-go-poker-web internal] load metadata for docker.io/library/node:18-alpine 3.4s
=> CANCELED [go-poker-go-poker internal] load metadata for docker.io/library/golang:1.18.2-alpine 3.5s
=> CANCELED [go-poker-go-poker internal] load metadata for docker.io/library/alpine:latest 3.5s
=> CANCELED [go-poker-go-poker-web base 1/1] FROM docker.io/library/node:18-alpine@sha256:e37da457874383fa921706 0.0s
=> => resolve docker.io/library/node:18-alpine@sha256:e37da457874383fa9217067867ec85fe8fe59f0bfa351ec9752a954386 0.0s
=> => sha256:538e4e1286473c79ec415222d2ed61c1112c00056ad7f212ce64c15c908bde41 1.72kB / 1.72kB 0.0s
=> => sha256:3bf7cda95541c7c761cae4bbf808f9494681beb4294f59fd18a28196371bcb16 6.36kB / 6.36kB 0.0s
=> => sha256:e37da457874383fa9217067867ec85fe8fe59f0bfa351ec9752a95438680056e 7.67kB / 7.67kB 0.0s
=> [go-poker-go-poker-web internal] load build context 0.0s
=> => transferring context: 467.52kB 0.0s
=> CACHED [go-poker-go-poker-web builder 1/5] WORKDIR /app 0.0s
=> CACHED [go-poker-go-poker-web deps 1/4] RUN apk add --no-cache libc6-compat 0.0s
=> CACHED [go-poker-go-poker-web deps 2/4] WORKDIR /app 0.0s
=> CACHED [go-poker-go-poker-web deps 3/4] COPY package.json package-lock.json* ./ 0.0s
=> CACHED [go-poker-go-poker-web deps 4/4] RUN if [ -f package-lock.json ]; then npm ci; else echo "Lockfile 0.0s
=> CACHED [go-poker-go-poker-web builder 2/5] COPY --from=deps /app/node_modules ./node_modules 0.0s
=> CACHED [go-poker-go-poker-web builder 3/5] COPY . . 0.0s
=> ERROR [go-poker-go-poker-web builder 4/5] COPY .env .env.production 0.0s
------
> [go-poker-go-poker-web builder 4/5] COPY .env .env.production:
------
failed to solve: failed to compute cache key: failed to calculate checksum of ref ab48fc57-9b83-47dc-b3fb-f46ff36cdd90::vszhmoiibem5kmym9bc4h33r1: "/.env": not found
@seba4316 There is a file in the repo .env.example
here, rename it to .env
. That should fill in the missing file.
Sorry, I completely missed that file.
I renamed that file to .env
, but I still got the same error message. When I tried copying it to the web
directory as well I got significantly further into the process, but I still ran into an issue
~/go-poker# docker compose -f docker-compose-dev.yaml build
[+] Building 36.7s (32/34)
=> [go-poker-go-poker-web internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 1.35kB 0.0s
=> [go-poker-go-poker-web internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [go-poker-go-poker-web internal] load metadata for docker.io/library/node:18-alpine 1.5s
=> [go-poker-go-poker internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [go-poker-go-poker internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 285B 0.0s
=> [go-poker-go-poker internal] load metadata for docker.io/library/alpine:latest 1.7s
=> [go-poker-go-poker internal] load metadata for docker.io/library/golang:1.18.2-alpine 1.4s
=> [go-poker-go-poker-web internal] load build context 0.0s
=> => transferring context: 2.24kB 0.0s
=> [go-poker-go-poker-web base 1/1] FROM docker.io/library/node:18-alpine@sha256:e37da457874383fa9217067867ec85fe8fe59f0bfa351ec9752a95438680056e 0.0s
=> CACHED [go-poker-go-poker-web runner 1/6] WORKDIR /app 0.0s
=> CACHED [go-poker-go-poker-web runner 2/6] RUN addgroup -g 1001 -S nodejs 0.0s
=> CACHED [go-poker-go-poker-web runner 3/6] RUN adduser -S nextjs -u 1001 0.0s
=> CACHED [go-poker-go-poker-web deps 1/4] RUN apk add --no-cache libc6-compat 0.0s
=> CACHED [go-poker-go-poker-web deps 2/4] WORKDIR /app 0.0s
=> CACHED [go-poker-go-poker-web deps 3/4] COPY package.json package-lock.json* ./ 0.0s
=> CACHED [go-poker-go-poker-web deps 4/4] RUN if [ -f package-lock.json ]; then npm ci; else echo "Lockfile not found." && exit 1; fi 0.0s
=> CACHED [go-poker-go-poker-web builder 2/5] COPY --from=deps /app/node_modules ./node_modules 0.0s
=> [go-poker-go-poker-web builder 3/5] COPY . . 0.0s
=> [go-poker-go-poker-web builder 4/5] COPY .env .env.production 0.0s
=> [go-poker-go-poker-web builder 5/5] RUN yarn build 34.5s
=> [go-poker-go-poker builder 1/5] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s
=> [go-poker-go-poker stage-1 1/4] FROM docker.io/library/alpine@sha256:b89d9c93e9ed3597455c90a0b88a8bbb5cb7188438f70953fede212a0c4394e0 0.0s
=> [go-poker-go-poker internal] load build context 0.0s
=> => transferring context: 767B 0.0s
=> CACHED [go-poker-go-poker stage-1 2/4] RUN adduser -S -D -H -h /app appuser 0.0s
=> CACHED [go-poker-go-poker builder 2/5] RUN mkdir /build 0.0s
=> CACHED [go-poker-go-poker builder 3/5] ADD . /build/ 0.0s
=> CACHED [go-poker-go-poker builder 4/5] WORKDIR /build 0.0s
=> CACHED [go-poker-go-poker builder 5/5] RUN go build cmd/go-poker/main.go 0.0s
=> CACHED [go-poker-go-poker stage-1 3/4] COPY --from=builder /build/main /app/ 0.0s
=> CACHED [go-poker-go-poker stage-1 4/4] WORKDIR /app 0.0s
=> [go-poker-go-poker] exporting to image 0.0s
=> => exporting layers 0.0s
=> => writing image sha256:8dfc8dfb01b0ba4efbda976a8fc1940f7ba9de9160eb7a715f7237692366d8f3 0.0s
=> => naming to docker.io/library/go-poker-go-poker 0.0s
=> ERROR [go-poker-go-poker-web runner 4/6] COPY --from=builder /app/public ./public 0.0s
------
> [go-poker-go-poker-web runner 4/6] COPY --from=builder /app/public ./public:
------
failed to solve: failed to compute cache key: failed to calculate checksum of ref ab48fc57-9b83-47dc-b3fb-f46ff36cdd90::a4mbvfx82em4bd4zi2vkl8t2y: "/app/public": not found
@seba4316 I'm away without a computer for the next few days so I can't actively debug this at the moment. I imagine you can try playing around with the node dockerfile (https://github.com/evanofslack/go-poker/blob/main/web/Dockerfile). Removing the line about copying that missing file is a start.
Hi, any update on this?
To run locally without modifying dockerfile
s, etc, here's what your .env
file should contain:
REDIS_URL="redis://redis:6379"
REDIS_PASSWORD=""
PORT="8080"
NODE_ENV=production
NEXT_PUBLIC_WS_URL=ws://localhost:8080/ws
NEXT_PUBLIC_API_URL=http://localhost:8080
/.env.example
to /.env
.env
to match:
REDIS_URL="redis://redis:6379"
REDIS_PASSWORD=""
PORT="8080"
NODE_ENV=production NEXT_PUBLIC_WS_URL=ws://localhost:8080/ws NEXT_PUBLIC_API_URL=http://localhost:8080
3. Copy `.env` to `./web` - it should now exist in the root of the repository with `docker-compose-dev.yaml`
4. If you have previously launched from docker-compose-dev, be sure to rebuild it after making changes
`docker compose -f docker-compose-dev.yaml build`
5. Bring up the containers
`docker compose -f docker-compose-dev.yaml up`
6. Access via `http://localhost:3000/`
![image](https://github.com/user-attachments/assets/859f5ef2-b85c-4e72-a213-65acfdbfacfc)
The instance on Vercel doesn't exist anymore, nor does the one on Heroku. How can I self-host my own instance? When cloning the repo and trying to
docker compose up
I get the following errors: