Code Monkey home page Code Monkey logo

Comments (12)

grenskul avatar grenskul commented on June 3, 2024 4

Made one .
The default pocketbase executable you're shipping is mac so I had to replace it .
Outside of that it's just following your prod build instructions
I left it with port 80 and http cause I expect most people to put this behind a reverse proxy
I also deleted the contents pb_data directory and deleted the client directory post build to save space

I built and pushed this to https://hub.docker.com/r/grenskul/ecourse but I'm probably not going to maintain this. It's a one off for a friend .

FROM node:20.11.0-buster
 
WORKDIR /

RUN git clone https://github.com/Ilyas-Codes/eCourse.git

WORKDIR /eCourse/client

RUN npm install 

RUN npm run build

RUN mv dist /eCourse/server/pb_public

RUN rm -r /eCourse/server/pb_data/*

RUN rm -r /eCourse/client

ADD pocketbase /eCourse/server/pocketbase

EXPOSE 80

CMD ["/eCourse/server/pocketbase", "serve", "--http=0.0.0.0:80"]

from ecourse.

tiritibambix avatar tiritibambix commented on June 3, 2024 2

I'd love to offer my help. Alas, all my attempts to learn Dockerfile have ended in abject failure 😅 I must confess I'm not the most computer-literate person in general ...
I hope someone else will be able to take this over :)
Take care.

from ecourse.

tiritibambix avatar tiritibambix commented on June 3, 2024 2

Oh that's awesome. Thanks you, it is working great :)

For anyone interested, here's the docker-compose I used:

version: '3.3'
services:
    ecourse:
        container_name: ecourse
        volumes:
            - '/path/to/eCourse/data:/eCourse/server/pb_data'
        ports:
            - '${PORT}:80'
        image: grenskul/ecourse

Can't the image creation be automated ? I believe I heard something about it.

from ecourse.

Ilyas-Codes avatar Ilyas-Codes commented on June 3, 2024 2

Thank you guys! just give me some time and I'll figure out this Docker stuff.

from ecourse.

Ilyas-Codes avatar Ilyas-Codes commented on June 3, 2024 1

Hey guys, can you try out this Dockerfile and let me know how it went? (I don't think my computer is able to handle docker) if all goes well, I'll close the issue and add the Dockerfile to the repo. thank you!

FROM node:20.11.1-buster

WORKDIR /

RUN git clone https://github.com/Ilyas-Codes/eCourse.git

ARG PB_VERSION=0.21.3
ADD https://github.com/pocketbase/pocketbase/releases/download/v${PB_VERSION}/pocketbase_${PB_VERSION}_linux_amd64.zip /tmp/pb.zip
RUN unzip /tmp/pb.zip -d /eCourse/pb

WORKDIR /eCourse/ui

RUN sed -i 's/^VITE_PROD_PB_URL=.*/VITE_PROD_PB_URL=http:\/\/127.0.0.1:8090/' .env
RUN npm install
RUN npm run build
RUN mv dist /eCourse/pb/pb_public

EXPOSE 8090

CMD ["/eCourse/pb/pocketbase", "serve", "--http=0.0.0.0:8090"]

from ecourse.

Ilyas-Codes avatar Ilyas-Codes commented on June 3, 2024

Hey @tiritibambix thanks for checking out my project!
I can't guarantee you that since I'm not very familiar with Docker and I'm quite busy with work right now, though I'd be happy if you'd like to submit a PR for that.

from ecourse.

grenskul avatar grenskul commented on June 3, 2024

It can be automated in many ways.
But like I said this was a one off for a friend. Feel free to take that code and make your own docker hub image and to automate if you wish (or just rebuild and push whenever you make substantial changes).
You have my permission to reuse, edit, publish, profit off, claim as your own or anything you want.
It's just a couple of lines and it took 15 minutes to make.
If you want to be extra nice you keep the same paths and port so my friend can switch over to the oficial image by just changing the image on his own config.

from ecourse.

tiritibambix avatar tiritibambix commented on June 3, 2024

You, Sir, are a gentleman and a scholar.

from ecourse.

parasiteoflife avatar parasiteoflife commented on June 3, 2024

Please reopen this issue, this afaik has not been implemented yet

from ecourse.

grenskul avatar grenskul commented on June 3, 2024
FROM node:20.11.0-buster
 
WORKDIR /

RUN git clone https://github.com/Ilyas-Codes/eCourse.git

WORKDIR /eCourse/ui

RUN rm .env

RUN echo -b "VITE_PROD_PB_URL=http://127.0.0.1:8090" >> .env

RUN npm install 

RUN npm run build

RUN ln -s /eCourse/pb /eCourse/server

RUN rm -r /eCourse/pb/pb_public

RUN mv dist /eCourse/pb/pb_public/

RUN rm -r /eCourse/ui

ADD pocketbase /eCourse/pb/pocketbase

EXPOSE 80

CMD ["/eCourse/pb/pocketbase", "serve", "--http=0.0.0.0:80"]

Fixed it accounting for new pathing and added a symlink to be compatible with my older container for people that just want to update. Also if you pull grenskul/ecourse:test instead of the old one with no tag you will get the new version.
To build this image you need the pocket base linux executable present in the same folder as the dockerfile

from ecourse.

Cregennan avatar Cregennan commented on June 3, 2024

Hey guys, can you try out this Dockerfile and let me know how it went? (I don't think my computer is able to handle docker) if all goes well, I'll close the issue and add the Dockerfile to the repo. thank you!

Yes, it actually works

from ecourse.

Ilyas-Codes avatar Ilyas-Codes commented on June 3, 2024

@Cregennan thank you, I will add it to the README now.

from ecourse.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.