Adds testing-host
w/ a dummy project.
This commit is contained in:
parent
5c22dd35cf
commit
315d35ca10
24
Dockerfile
24
Dockerfile
@ -6,21 +6,25 @@ ARG POSTGRES_VERSION=15
|
||||
RUN apt-get update \
|
||||
&& curl -sLS https://deb.nodesource.com/setup_$NODE_VERSION.x | bash - \
|
||||
&& apt-get install -y nodejs \
|
||||
&& npm install -g npm
|
||||
&& npm install -g npm
|
||||
|
||||
RUN apt-get install -y php-pgsql
|
||||
RUN apt-get install -y php-pgsql openssh-client
|
||||
|
||||
RUN apt-get -y autoremove \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
|
||||
|
||||
# Adding test ssh key
|
||||
# Adding Coolify User and SSH key to connect to the Testing-Host (which is simulation of a VPS)
|
||||
RUN useradd -ms /bin/bash coolify
|
||||
USER coolify
|
||||
RUN mkdir -p ~/.ssh
|
||||
RUN echo "-----BEGIN OPENSSH PRIVATE KEY-----\n\
|
||||
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW\n\
|
||||
QyNTUxOQAAACBbhpqHhqv6aI67Mj9abM3DVbmcfYhZAhC7ca4d9UCevAAAAJi/QySHv0Mk\n\
|
||||
hwAAAAtzc2gtZWQyNTUxOQAAACBbhpqHhqv6aI67Mj9abM3DVbmcfYhZAhC7ca4d9UCevA\n\
|
||||
AAAECBQw4jg1WRT2IGHMncCiZhURCts2s24HoDS0thHnnRKVuGmoeGq/pojrsyP1pszcNV\n\
|
||||
uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==\n\
|
||||
-----END OPENSSH PRIVATE KEY-----" >> ~/.ssh/id_ed25519
|
||||
RUN chmod 0600 ~/.ssh/id_ed25519
|
||||
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW\n\
|
||||
QyNTUxOQAAACBbhpqHhqv6aI67Mj9abM3DVbmcfYhZAhC7ca4d9UCevAAAAJi/QySHv0Mk\n\
|
||||
hwAAAAtzc2gtZWQyNTUxOQAAACBbhpqHhqv6aI67Mj9abM3DVbmcfYhZAhC7ca4d9UCevA\n\
|
||||
AAAECBQw4jg1WRT2IGHMncCiZhURCts2s24HoDS0thHnnRKVuGmoeGq/pojrsyP1pszcNV\n\
|
||||
uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==\n\
|
||||
-----END OPENSSH PRIVATE KEY-----" >> ~/.ssh/id_ed25519
|
||||
RUN chmod 0600 ~/.ssh/id_ed25519
|
||||
|
||||
USER root
|
||||
|
@ -1,6 +1,7 @@
|
||||
version: '3.8'
|
||||
services:
|
||||
php:
|
||||
image: coolify:4
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
@ -13,12 +14,16 @@ services:
|
||||
SSL_MODE: 'off'
|
||||
volumes:
|
||||
- .:/var/www/html
|
||||
networks:
|
||||
- coolify
|
||||
postgres:
|
||||
image: postgres:15-alpine
|
||||
ports:
|
||||
- "${FORWARD_DB_PORT:-5432}:5432"
|
||||
volumes:
|
||||
- db-coolify:/var/lib/postgresql/data
|
||||
networks:
|
||||
- coolify
|
||||
environment:
|
||||
POSTGRES_USER: "${DB_USERNAME}"
|
||||
POSTGRES_PASSWORD: "${DB_PASSWORD}"
|
||||
@ -34,7 +39,22 @@ services:
|
||||
]
|
||||
retries: 3
|
||||
timeout: 5s
|
||||
testing-host:
|
||||
container_name: coolify-testing-host
|
||||
image: coolify-testing-host
|
||||
build:
|
||||
dockerfile: Dockerfile
|
||||
context: ./docker/testing-host
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- ./docker/testing-host/supervisord.conf:/etc/supervisor/conf.d/supervisord.conf
|
||||
networks:
|
||||
- coolify
|
||||
|
||||
volumes:
|
||||
db-coolify:
|
||||
driver: local
|
||||
|
||||
networks:
|
||||
coolify:
|
||||
driver: bridge
|
||||
|
67
docker/testing-host/Dockerfile
Normal file
67
docker/testing-host/Dockerfile
Normal file
@ -0,0 +1,67 @@
|
||||
FROM ubuntu:22.04
|
||||
|
||||
ARG TARGETPLATFORM
|
||||
|
||||
# https://download.docker.com/linux/static/stable/
|
||||
ARG DOCKER_VERSION=20.10.18
|
||||
# https://github.com/docker/compose/releases
|
||||
# Reverted to 2.6.1 because of this https://github.com/docker/compose/issues/9704. 2.9.0 still has a bug.
|
||||
ARG DOCKER_COMPOSE_VERSION=2.6.1
|
||||
# https://github.com/buildpacks/pack/releases
|
||||
ARG PACK_VERSION=v0.27.0
|
||||
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
ENV TZ=UTC
|
||||
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y gnupg gosu curl ca-certificates zip unzip git git-lfs supervisor \
|
||||
sqlite3 libcap2-bin libpng-dev python2 dnsutils openssh-server sudo \
|
||||
&& apt-get -y autoremove \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
# Setup sshd
|
||||
RUN ssh-keygen -A
|
||||
RUN mkdir -p /run/sshd
|
||||
|
||||
# Install Docker CLI, Docker Compose, and Pack
|
||||
RUN mkdir -p ~/.docker/cli-plugins
|
||||
RUN curl -SL https://cdn.coollabs.io/bin/$TARGETPLATFORM/docker-$DOCKER_VERSION -o /usr/bin/docker
|
||||
RUN curl -SL https://cdn.coollabs.io/bin/$TARGETPLATFORM/docker-compose-linux-$DOCKER_COMPOSE_VERSION -o ~/.docker/cli-plugins/docker-compose
|
||||
RUN curl -SL https://cdn.coollabs.io/bin/$TARGETPLATFORM/pack-$PACK_VERSION -o /usr/local/bin/pack
|
||||
RUN curl -sSL https://nixpacks.com/install.sh | bash
|
||||
RUN chmod +x ~/.docker/cli-plugins/docker-compose /usr/bin/docker /usr/local/bin/pack
|
||||
RUN groupadd docker
|
||||
|
||||
# Setup coolify user
|
||||
RUN useradd -ms /bin/bash coolify
|
||||
RUN usermod -aG sudo coolify
|
||||
RUN usermod -aG docker coolify
|
||||
RUN echo 'coolify ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
|
||||
|
||||
# Setup ssh'ing into the destination as Coolify User
|
||||
USER coolify
|
||||
RUN mkdir -p ~/.ssh
|
||||
RUN echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFuGmoeGq/pojrsyP1pszcNVuZx9iFkCELtxrh31QJ68 coolify@coolify-instance" >> ~/.ssh/authorized_keys
|
||||
|
||||
USER root
|
||||
|
||||
# Setup ssh'ing into the destination as Root
|
||||
RUN mkdir -p ~/.ssh
|
||||
RUN echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFuGmoeGq/pojrsyP1pszcNVuZx9iFkCELtxrh31QJ68 coolify@coolify-instance" >> ~/.ssh/authorized_keys
|
||||
|
||||
EXPOSE 22
|
||||
|
||||
COPY start-container /usr/local/bin/start-container
|
||||
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||
RUN chmod +x /usr/local/bin/start-container
|
||||
|
||||
WORKDIR /root
|
||||
|
||||
# Prepare projects
|
||||
RUN mkdir -p projects
|
||||
COPY dummy-project projects/dummy-project
|
||||
|
||||
ENTRYPOINT ["start-container"]
|
31
docker/testing-host/dummy-project/Dockerfile
Normal file
31
docker/testing-host/dummy-project/Dockerfile
Normal file
@ -0,0 +1,31 @@
|
||||
FROM ubuntu:22.04
|
||||
|
||||
ARG WWWGROUP
|
||||
|
||||
WORKDIR /var/www/html
|
||||
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
ENV TZ=UTC
|
||||
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y gnupg gosu curl ca-certificates zip unzip git git-lfs supervisor sqlite3 libcap2-bin libpng-dev python2 dnsutils \
|
||||
&& curl -sS 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c' | gpg --dearmor | tee /usr/share/keyrings/ppa_ondrej_php.gpg > /dev/null \
|
||||
&& echo "deb [signed-by=/usr/share/keyrings/ppa_ondrej_php.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y php8.2-cli php8.2-dev \
|
||||
php8.2-curl php8.2-mbstring php8.2-xml php8.2-zip php8.2-bcmath \
|
||||
php8.2-intl php8.2-readline php8.2-msgpack php8.2-igbinary \
|
||||
&& php -r "readfile('https://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer \
|
||||
&& apt-get -y autoremove \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
RUN setcap "cap_net_bind_service=+ep" /usr/bin/php8.2
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
COPY . .
|
||||
|
||||
ENTRYPOINT ["php", "-S", "0.0.0.0:8000"]
|
10
docker/testing-host/dummy-project/docker-compose.yml
Normal file
10
docker/testing-host/dummy-project/docker-compose.yml
Normal file
@ -0,0 +1,10 @@
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
dummy-project:
|
||||
image: dummy-project
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
3
docker/testing-host/dummy-project/index.php
Normal file
3
docker/testing-host/dummy-project/index.php
Normal file
@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
echo "Hello World! " . date('Y-m-d H:i:s');
|
3
docker/testing-host/start-container
Normal file
3
docker/testing-host/start-container
Normal file
@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
|
13
docker/testing-host/supervisord.conf
Normal file
13
docker/testing-host/supervisord.conf
Normal file
@ -0,0 +1,13 @@
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
user=root
|
||||
logfile=/var/log/supervisor/supervisord.log
|
||||
pidfile=/var/run/supervisord.pid
|
||||
|
||||
[program:sshd]
|
||||
command=/usr/sbin/sshd -D
|
||||
user=root
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
Loading…
Reference in New Issue
Block a user