-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from bluesky-social/bnewbold/fix-dockerfile
README tweaks, dockerfile updates
- Loading branch information
Showing
3 changed files
with
124 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,21 @@ | ||
FROM debian:bullseye-slim | ||
FROM node:20.11-alpine3.18 | ||
|
||
ENV TZ=Etc/UTC | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
ENV NODE_VERSION=18 | ||
ENV NVM_DIR=/usr/share/nvm | ||
RUN apk add --update dumb-init | ||
|
||
ENV TZ=Etc/UTC | ||
WORKDIR /usr/src/ozone | ||
|
||
COPY package.json yarn.lock . | ||
RUN yarn | ||
COPY . . | ||
|
||
RUN apt-get update && apt-get install --yes \ | ||
dumb-init \ | ||
ca-certificates \ | ||
wget | ||
|
||
RUN mkdir --parents $NVM_DIR && \ | ||
wget \ | ||
--output-document=/tmp/nvm-install.sh \ | ||
https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh && \ | ||
bash /tmp/nvm-install.sh | ||
|
||
RUN \. "$NVM_DIR/nvm.sh" && \ | ||
nvm install $NODE_VERSION && \ | ||
nvm use $NODE_VERSION && \ | ||
npm install --global yarn && \ | ||
yarn && \ | ||
yarn build | ||
|
||
RUN yarn build | ||
RUN chown -R node:node .next | ||
|
||
ENTRYPOINT ["dumb-init", "--"] | ||
EXPOSE 3000 | ||
USER node | ||
CMD ["yarn", "start"] | ||
|
||
CMD ["bash", "-c", "source /usr/share/nvm/nvm.sh && yarn start"] | ||
LABEL org.opencontainers.image.source=https://github.com/bluesky-social/ozone-ui | ||
LABEL org.opencontainers.image.description="Ozone Moderation Service Web UI" | ||
LABEL org.opencontainers.image.licenses=MIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
|
||
### General Tips | ||
|
||
You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file. | ||
|
||
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`. | ||
|
||
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages. | ||
|
||
### Local Integerated Development Setup | ||
|
||
Ozone requires a PDS service to talk to, and it is convenient to point it to a local `dev-env` instance for testing during development. | ||
|
||
1. In the separate [atproto project](https://github.com/bluesky-social/atproto), run the dev server using `yarn workspace @atproto/dev-env start`. This will run a PDS, seeded with some users and data for you. | ||
2. Run the development server for Ozone using `yarn dev`. This will start running the Ozone frontend at `http://localhost:3000`. | ||
3. Navigate to the login page in your browser, at [http://localhost:3000](http://localhost:3000). | ||
4. Login using the atproto dev-env credentials, which you can find [here](https://github.com/bluesky-social/atproto/blob/a1240f0a37030766dfe0a2ccfdc2810432520ae9/packages/dev-env/src/mock/index.ts#L59-L84). For development some example login credentials that would are: | ||
- Service URL: http://localhost:2583 | ||
- Account handle: alice.test | ||
- Password: hunter2 | ||
- Admin Token: admin-pass | ||
|
||
### Working with unpublished changes to the `@atproto/api` package | ||
|
||
In the course of development there may be updates to the atproto client that are not yet published to npm, but you would like to use with Ozone. Here's the workflow for using unpublished changes to the @atproto/api package: | ||
|
||
1. Ensure the [atproto/](https://github.com/bluesky-social/atproto) project lives as a sibling to the [ozone/](https://github.com/bluesky-social/ozone) project on your filesystem (or adjust the path used in step 4). | ||
|
||
``` | ||
~/Documents/bluesky | ||
❯ ls -l | ||
total 19856 | ||
drwxr-xr-x 22 user group 704 Jan 19 15:51 atproto | ||
drwxr-xr-x 24 user group 768 Jan 24 19:17 ozone | ||
``` | ||
|
||
2. Checkout whichever branch you'd like to use in atproto/ for the @atproto/api package. | ||
|
||
``` | ||
~/Documents/bluesky | ||
❯ cd atproto | ||
~/Documents/bluesky/atproto | ||
❯ git checkout main | ||
``` | ||
|
||
3. Build the @atproto/api package in atproto/. | ||
|
||
``` | ||
~/Documents/bluesky/atproto | ||
❯ yarn | ||
``` | ||
|
||
4. Update the package.json file in ozone/ to reference the local build of @atproto/api. | ||
|
||
```diff | ||
"dependencies": { | ||
- "@atproto/api": "^0.0.3", | ||
+ "@atproto/api": "link:../atproto/packages/api/dist", | ||
"@headlessui/react": "^1.7.7", | ||
``` | ||
|
||
5. Ask yarn to reinstall, creating the link from ozone/ to the local build of @atproto/api. | ||
``` | ||
~/Documents/bluesky/ozone | ||
❯ yarn | ||
``` | ||
6. Take care not to check-in the changes to package.json and yarn.lock that came from the temporary linking. When you're done, you can reset everything with: | ||
``` | ||
~/Documents/bluesky/ozone | ||
❯ git checkout package.json yarn.lock && yarn | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters