我正在尝试拉取我在进行码头工作时进行处理的存储库,因此我按了this tutorial,因此我添加了 <?php
session_start();
require "../database.php";
$receiver = $_POST[ 'invite-email' ];
$user_id = $_SESSION[ 'user_id' ];
$sql = "SELECT * FROM user WHERE id = '$user_id' LIMIT 1";
$result = $con->query( $sql );
while ( $row = $result->fetch_assoc() ) {
$first_name = $row[ 'first_name' ];
$last_name = $row[ 'last_name' ];
}
$sql = "SELECT * FROM user_house_link WHERE user_id = '$user_id' LIMIT 1";
$result = $con->query( $sql );
while ( $row = $result->fetch_assoc() ) {
$house_id = $row[ 'house_id' ];
}
$sql = "SELECT * FROM house WHERE house_id = '$house_id' LIMIT 1";
$result = $con->query( $sql );
while ( $row = $result->fetch_assoc() ) {
$join_code = $row[ 'join_code' ];
$join_pin = $row[ 'join_password' ];
}
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
require '../../PHPMailer/PHPMailer.php';
require '../../PHPMailer/SMTP.php';
require '../../PHPMailer/Exception.php';
$mail = new PHPMailer(true); // Passing `true` enables exceptions
try {
//Server settings
$mail->SMTPDebug = 2; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'mail.studentplan.ml'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'invitations@studentplan.ml'; // SMTP username
$mail->Password = //hidden'; // SMTP password
$mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 465; // TCP port to connect to
//Recipients
$mail->setFrom('invitations@studentplan.ml', 'StudentPlan');
$mail->addAddress($receiver); // Add a recipient
// $mail->addAddress('ellen@example.com'); // Name is optional
$mail->addReplyTo('contact@studentplan.ml', 'Contact');
//$mail->addCC($em);
//$mail->addBCC('callum@callumpilton.co.uk');
//Attachments
// $mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
//$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
//Content
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'StudentPlan House Code';
$mail->Body = "<div style='background-color:#0288D1; width:100%;text-align:center;'><img src='http://studentplan.ml/img/mail/logo.png' alt='logo' width='100px'/></div>
<h1 style='text-align:center;'>StudentPlan</h1>
<h1 style='text-align:center'>Join {$first_name} {$last_name}'s house.</h1>
<p style='text-align:center'>Student Plan lets you to manage your lessons and exams, take and share notes, create and play revision quizzes, and track your finances in a shared house.</p>
<p style='text-align:center'>Connect with your housemates to keep track of your bills and payments, as well as much more.</p>
<p style='text-align:center'>Join Code: {$join_code}</p>
<p style='text-align:center'>House PIN: {$join_pin}</p>
<p style='text-align:center'>Join {$first_name} and let us plan your student life for you!</p>";
$mail->AltBody = "Student Plan
Join {$first_name} {$last_name}'s house.
Student Plan lets you to manage your lessons and exams, take and share notes, create and play revision quizzes, and track your finances in a shared house.
Connect with your housemates to keep track of your bills and payments, as well as much more.
Join Code: {$join_code}
House PIN: {$join_pin}
Join {$first_name} and let us plan your student life for you!";
$mail->send();
echo 'Message has been sent';
} catch (Exception $e) {
echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo;
}
Dockerfile
在我添加的# this is our first build stage, it will not persist in the final image
FROM ubuntu as intermediate
# install git
RUN apt-get update \
apt-get upgrade \
apt-get install git
# add credentials on build
RUN mkdir ~/.ssh && ln -s /run/secrets/host_ssh_key ~/.ssh/id_rsa
# make sure your domain is accepted
RUN touch /root/.ssh/known_hosts
RUN ssh-keyscan github.org >> /root/.ssh/known_hosts
RUN git clone git@github.com:my-repo/myproject.git
FROM ubuntu
# copy the repository form the previous image
COPY --from=intermediate /your-repo /srv/your-repo
docker-compose.yml
我正在添加
secrets:
host_ssh_key:
file: ~/.ssh/id_rsa
在其中一项服务中。
由于这仅供我本地使用(我不打算在制作中部署或使用它,我只是想测试它)这样使用它是好的 - 如果它& #39; ll工作,因为目前构建在git install阶段失败,错误
E:update命令不带参数
错误:服务&#39;网络&#39;无法构建:命令&#39; / bin / sh -c apt-get update apt-get upgrade apt-get install git&#39;返回非零代码:100
我错过了什么?
答案 0 :(得分:14)
你正在分析这个。这只是一个简单的错字。应该是:
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y git
这是3个单独的命令。
答案 1 :(得分:5)
一些想法:
apt-get install git
替换为apt-get install --assume-yes git
。如果没有--assume-yes
,它将提示您进行确认,而您无法提供,并且它足够聪明,可以解决这个问题并假设您的意思是“不”。0600
。我会复制它,特别是chmod 0600 ~/.ssh/id_rsa
来确定。总的来说,你的Dockerfile看起来非常聪明,我从阅读中得到了一些新的想法。干得好!
答案 2 :(得分:4)
对于使用alpine
图像的人来说,RUN apk add --no-cache git
为我完成了窍门。