Skip to content

Update Docker Configuration #3189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM node:16.14.2 as base
FROM node:16.14.2 AS base
ENV APP_HOME=/usr/src/app \
TERM=xterm
RUN mkdir -p $APP_HOME
WORKDIR $APP_HOME
EXPOSE 8000
EXPOSE 8002

FROM base as development
FROM base AS development
ENV NODE_ENV development
COPY package.json package-lock.json ./
RUN npm install
Expand All @@ -18,11 +18,11 @@ COPY translations/locales ./translations/locales
COPY public ./public
CMD ["npm", "start"]

FROM development as build
FROM development AS build
ENV NODE_ENV production
RUN npm run build

FROM base as production
FROM base AS production
ENV NODE_ENV=production
COPY package.json package-lock.json index.js ./
RUN npm install --production
Expand Down
1 change: 1 addition & 0 deletions contributor_docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Note that this takes up a significant amount of space on your machine. Make sure
2. Install [Docker Desktop](https://www.docker.com/products/docker-desktop/)
3. Clone this repository and cd into it
4. `$ docker-compose -f docker-compose-development.yml build`
* Note: Depending on which version of Docker Compose you are using, the base command will be either `docker-compose` or `docker compose`. More information about it can be found in Docker Compose's documentation for their [V1 to V2 transition](https://github.com/docker/compose/tree/v1?tab=readme-ov-file#v1-vs-v2-transition-hourglass_flowing_sand).
5. `$ cp .env.example .env`
6. (Optional) Update `.env` with necessary keys to enable certain app behaviors, i.e. add Github ID and Github Secret if you want to be able to log in with Github.
* See the [GitHub API Configuration](#github-api-configuration) section for information on how to authenticate with Github.
Expand Down
3 changes: 1 addition & 2 deletions docker-compose-development.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
version: '3.4'
services:
mongo:
image: mongo:4.4
image: mongo:5.0
volumes:
- dbdata:/data/db
app:
Expand Down
3 changes: 1 addition & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
version: '3.4'
services:
mongo:
image: mongo:4.4
image: mongo:5.0
volumes:
- dbdata:/data/db
app:
Expand Down
2 changes: 1 addition & 1 deletion server/models/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ collectionSchema.set('toJSON', {
});

collectionSchema.pre('save', function generateSlug(next) {
this.slug = slugify(this.name, { lower: true, strict: true });
this.slug = slugify(this.name, '_');
next();
});

Expand Down
2 changes: 1 addition & 1 deletion server/models/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ projectSchema.set('toJSON', {

projectSchema.pre('save', function generateSlug(next) {
if (!this.slug) {
this.slug = slugify(this.name, { lower: true, strict: true });
this.slug = slugify(this.name, '_');
}
next();
});
Expand Down
8 changes: 4 additions & 4 deletions server/scripts/examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async function getCategories() {
const categories = [];
const options = {
url:
'https://api.github.com/repos/processing/p5.js-website/contents/src/data/examples/en',
'https://api.github.com/repos/processing/p5.js-website-legacy/contents/src/data/examples/en',
method: 'GET',
headers: {
...headers,
Expand Down Expand Up @@ -205,7 +205,7 @@ async function addAssetsToProject(assets, response, project) {
// for assets files that are not .vert or .frag extension
project.files.push({
name: assetName,
url: `https://cdn.jsdelivr.net/gh/processing/p5.js-website@main/src/data/examples/assets/${assetName}`,
url: `https://cdn.jsdelivr.net/gh/processing/p5.js-website-legacy@main/src/data/examples/assets/${assetName}`,
id: fileID,
_id: fileID,
children: [],
Expand All @@ -223,7 +223,7 @@ async function addAssetsToProject(assets, response, project) {
async function createProjectsInP5user(projectsInAllCategories) {
const options = {
url:
'https://api.github.com/repos/processing/p5.js-website/contents/src/data/examples/assets',
'https://api.github.com/repos/processing/p5.js-website-legacy/contents/src/data/examples/assets',
method: 'GET',
headers: {
...headers,
Expand Down Expand Up @@ -364,7 +364,7 @@ async function getp5User() {
const categories = await getCategories();
const sketchesInCategories = await getSketchesInCategories(categories);
const sketchContent = await getSketchContent(sketchesInCategories);
const projectsInUser = createProjectsInP5user(sketchContent);
const projectsInUser = await createProjectsInP5user(sketchContent);
return projectsInUser;
}

Expand Down
Loading