4 ms·
- I need help on generating a docker image. Would be great if someone contributes to this. - Sure, I was thinking about that. Being this a self-hosted software
by mysticmode 7y ago
- I need help on generating a docker image. Would be great if someone contributes to this.
- Sure, I was thinking about that. Being this a self-hosted software, I should have used those vendor js libraries directly. But it was hyper fast when I used Cloudflare CDN that blinded my eyes. Anyways, I'll release a patch version today using the js libraries directly.
- nirui 7y agoHello, it's been a few days, I hope you can still receive this. I cloned your project and made a Dockerfile for it. It works on my Arm32 based board so I guess it should work on other platforms as well. The file is here, should be a good starting point if you want to further develop the Docker image, please test it: # This is an experimental Dockerfile for Sorcia Git front-end # # This image allows both easy deployment and use. The deployer # can operate the resulting container via Docker remote management # with command such as: # # `docker -H <docker_server> exec sorcia /home/git/sorcia/sorcia usermod` # # to manage the service rather than having to login onto the Docker # host. # # To build the image, use command # # `docker build --tag <final_image_name> .` # # Or, setup a hook on Docker cloud, let it do the hard job for you. # # To run the image, use command: # # `docker run \ # --detach \ # --restart always \ # --name sorcia \ # --publish 1937:1937 \ # You may have to change this port number # --publish 2222:2222 \ # iptables maybe needed if you want port 22 # <final_image_name> web` # # To run usermod, when the container is running, run: # # `docker exec -it <container_name> /home/git/sorcia/sorcia usermod` # # Notice: This image does not contain Nginx, if you need it, put it in # a separate container. # # Step 1: Initialize the build enviroment and build the application # # Here we are using the golang:alpine which is the latest Go but # is compiled for Alpine. This is necessary because we will later # run the service on an Alpine base (musl based). # # Step 1.0: Copy all source file into the container # Step 1.1: Install Git to download go modules, and build-base to # build the dependencies # Step 1.2: Print the version of the bulitin Go # Step 1.3: Goto /sorcia directory and start the building process # FROM golang:alpine as builder COPY . /sorcia RUN set -ex && \ until apk add build-base git sqlite-dev; do sleep 1; done && \ ([ -z "$HTTP_PROXY" ] || (git config --global http.proxy "$HTTP_PROXY")) && \ ([ -z "$HTTPS_PROXY" ] || (git config --global https.proxy "$HTTPS_PROXY")) && \ go version && \ cd /sorcia && \ until CGO_ENABLED=1 go build; do sleep 1; done # Step 2: Setup the image that will actually run the service # # Step 2.0: Copy the generated binary along with source file into # the container # Step 2.1: Install the dependencies: Git and Sqlite # Step 2.2: Create user and user group git and sorcia, we'll run the # service application under user sorcia # Step 2.3: Initialize the enviroment (Directory and other stuff) # FROM alpine:latest COPY --from=builder /sorcia /home/git/sorcia RUN set -ex && \ ls -l /home/git/sorcia && \ cp /home/git/sorcia/config/app.ini.sample /home/git/sorcia/config/app.ini && \ sed -i -E "s/ssh_port.+\=.+/ssh_port = 2222/" /home/git/sorcia/config/app.ini && \ echo && cat /home/git/sorcia/config/app.ini && echo && \ until apk add --no-cache openssh git sqlite; do sleep 1; done && \ addgroup -S sorcia && adduser -S -G sorcia sorcia && \ mkdir -p /home/git/data && chown sorcia:sorcia /home/git/data && \ chmod +x /home/git/sorcia/sorcia && \ (cd /home/git/sorcia; rm error.log -f; ln -s /tmp/error.log error.log; ./sorcia version) WORKDIR /home/git/sorcia USER sorcia EXPOSE 1937 2222 ENTRYPOINT [ "/home/git/sorcia/sorcia" ] CMD []