Skip to content
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

sync from templates #76

Closed
wants to merge 1 commit into from
Closed
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
29 changes: 19 additions & 10 deletions 6.10/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
FROM oryxprod/node-6.10:20190301.2

FROM mcr.microsoft.com/oryx/node-6.10:20190508.1
LABEL maintainer="Azure App Services Container Images <[email protected]>"

COPY startup /opt/startup
COPY hostingstart.html /home/site/wwwroot/hostingstart.html
RUN echo "ipv6" >> /etc/modules

RUN npm install -g pm2 \
&& mkdir -p /home/LogFiles \
&& mkdir -p /home/LogFiles /opt/startup \
&& echo "root:Docker!" | chpasswd \
&& echo "cd /home" >> /etc/bash.bashrc \
&& apt update \
&& apt install -y --no-install-recommends openssh-server vim curl wget tcptraceroute \
&& cd /opt/startup \
&& npm install \
&& chmod 755 /opt/startup/init_container.sh
&& apt-get update \
&& apt-get install --yes --no-install-recommends openssh-server vim curl wget tcptraceroute openrc

# setup default site
RUN rm -f /etc/ssh/sshd_config
COPY startup /opt/startup
COPY hostingstart.html /opt/startup

# configure startup
RUN mkdir -p /tmp
COPY sshd_config /etc/ssh/

COPY ssh_setup.sh /tmp
RUN chmod -R +x /opt/startup \
&& chmod -R +x /tmp/ssh_setup.sh \
&& (sleep 1;/tmp/ssh_setup.sh 2>&1 > /dev/null) \
&& rm -rf /tmp/* \
&& cd /opt/startup \
&& npm install

ENV PORT 8080
ENV SSH_PORT 2222
EXPOSE 2222 8080
Expand Down
26 changes: 26 additions & 0 deletions 6.10/ssh_setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/sh

if [ ! -f "/etc/ssh/ssh_host_rsa_key" ]; then
# generate fresh rsa key
ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa
fi

if [ ! -f "/etc/ssh/ssh_host_dsa_key" ]; then
# generate fresh dsa key
ssh-keygen -f /etc/ssh/ssh_host_dsa_key -N '' -t dsa
fi

if [ ! -f "/etc/ssh/ssh_host_ecdsa_key" ]; then
# generate fresh ecdsa key
ssh-keygen -f /etc/ssh/ssh_host_ecdsa_key -N '' -t dsa
fi

if [ ! -f "/etc/ssh/ssh_host_ed25519_key" ]; then
# generate fresh ecdsa key
ssh-keygen -f /etc/ssh/ssh_host_ed25519_key -N '' -t dsa
fi

#prepare run dir
if [ ! -d "/var/run/sshd" ]; then
mkdir -p /var/run/sshd
fi
3 changes: 2 additions & 1 deletion 6.10/sshd_config
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ Port SSH_PORT
ListenAddress 0.0.0.0
LoginGraceTime 180
X11Forwarding yes
Ciphers aes128-cbc,3des-cbc,aes256-cbc
Ciphers aes128-cbc,3des-cbc,aes256-cbc,aes128-ctr,aes192-ctr,aes256-ctr
MACs hmac-sha1,hmac-sha1-96
StrictModes yes
SyslogFacility DAEMON
PasswordAuthentication yes
PermitEmptyPasswords no
PermitRootLogin yes
Subsystem sftp internal-sftp
4 changes: 2 additions & 2 deletions 6.10/startup/default-static-site.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ var server = express();
var options = {
index: 'hostingstart.html'
};
server.use('/', express.static('/home/site/wwwroot', options));
server.listen(process.env.PORT);
server.use('/', express.static('/opt/startup', options));
server.listen(process.env.PORT);
34 changes: 26 additions & 8 deletions 6.10/startup/init_container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,41 @@ A P P S E R V I C E O N L I N U X

Documentation: http://aka.ms/webapp-linux
NodeJS quickstart: https://aka.ms/node-qs
NodeJS Version : `node --version`

EOL
cat /etc/motd

sed -i "s/SSH_PORT/$SSH_PORT/g" /etc/ssh/sshd_config
service ssh start

mkdir "$PM2HOME"
chmod 777 "$PM2HOME"
ln -s /home/LogFiles "$PM2HOME"/logs

# Get environment variables to show up in SSH session
eval $(printenv | awk -F= '{print "export " $1"="$2 }' >> /etc/profile)
eval $(printenv | sed -n "s/^\([^=]\+\)=\(.*\)$/export \1=\2/p" | sed 's/"/\\\"/g' | sed '/=/s//="/' | sed 's/$/"/' >> /etc/profile)

# starting sshd process
sed -i "s/SSH_PORT/$SSH_PORT/g" /etc/ssh/sshd_config
/usr/sbin/sshd

STARTUP_COMMAND_PATH="/opt/startup/startup.sh"
ORYX_ARGS="-appPath /home/site/wwwroot -output $STARTUP_COMMAND_PATH -usePM2 -defaultApp=/opt/startup/default-static-site.js -userStartupCommand '$@'"

if [ "$APPSVC_REMOTE_DEBUGGING" = "TRUE" ]; then
ORYX_ARGS="-remoteDebug -debugPort $APPSVC_TUNNEL_PORT $ORYX_ARGS"
elif [ "$APPSVC_REMOTE_DEBUGGING_BREAK" = "TRUE" ]; then
ORYX_ARGS="-remoteDebugBrk -debugPort $APPSVC_TUNNEL_PORT $ORYX_ARGS"
fi

if [ -f "oryx-manifest.toml" ] && [ "$APPSVC_RUN_ZIP" = "TRUE" ]; then
# NPM adds the current directory's node_modules/.bin folder to PATH before it runs, so commands in
# "npm start" can files there. Since we move node_modules, we have to add it to the path ourselves.
echo 'Fixing up path'
export PATH=/node_modules/.bin:$PATH
echo "$PATH"
fi

echo "$@" > /opt/startup/startupCommand
node /opt/startup/generateStartupCommand.js
eval oryx $ORYX_ARGS

STARTUPCOMMAND=$(cat /opt/startup/startupCommand)
STARTUPCOMMAND=$(cat $STARTUP_COMMAND_PATH)
echo "Running $STARTUPCOMMAND"
eval "exec $STARTUPCOMMAND"
$STARTUP_COMMAND_PATH
29 changes: 19 additions & 10 deletions 6.11/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
FROM oryxprod/node-6.11:20190301.2

FROM mcr.microsoft.com/oryx/node-6.11:20190508.1
LABEL maintainer="Azure App Services Container Images <[email protected]>"

COPY startup /opt/startup
COPY hostingstart.html /home/site/wwwroot/hostingstart.html
RUN echo "ipv6" >> /etc/modules

RUN npm install -g pm2 \
&& mkdir -p /home/LogFiles \
&& mkdir -p /home/LogFiles /opt/startup \
&& echo "root:Docker!" | chpasswd \
&& echo "cd /home" >> /etc/bash.bashrc \
&& apt update \
&& apt install -y --no-install-recommends openssh-server vim curl wget tcptraceroute \
&& cd /opt/startup \
&& npm install \
&& chmod 755 /opt/startup/init_container.sh
&& apt-get update \
&& apt-get install --yes --no-install-recommends openssh-server vim curl wget tcptraceroute openrc

# setup default site
RUN rm -f /etc/ssh/sshd_config
COPY startup /opt/startup
COPY hostingstart.html /opt/startup

# configure startup
RUN mkdir -p /tmp
COPY sshd_config /etc/ssh/

COPY ssh_setup.sh /tmp
RUN chmod -R +x /opt/startup \
&& chmod -R +x /tmp/ssh_setup.sh \
&& (sleep 1;/tmp/ssh_setup.sh 2>&1 > /dev/null) \
&& rm -rf /tmp/* \
&& cd /opt/startup \
&& npm install

ENV PORT 8080
ENV SSH_PORT 2222
EXPOSE 2222 8080
Expand Down
26 changes: 26 additions & 0 deletions 6.11/ssh_setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/sh

if [ ! -f "/etc/ssh/ssh_host_rsa_key" ]; then
# generate fresh rsa key
ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa
fi

if [ ! -f "/etc/ssh/ssh_host_dsa_key" ]; then
# generate fresh dsa key
ssh-keygen -f /etc/ssh/ssh_host_dsa_key -N '' -t dsa
fi

if [ ! -f "/etc/ssh/ssh_host_ecdsa_key" ]; then
# generate fresh ecdsa key
ssh-keygen -f /etc/ssh/ssh_host_ecdsa_key -N '' -t dsa
fi

if [ ! -f "/etc/ssh/ssh_host_ed25519_key" ]; then
# generate fresh ecdsa key
ssh-keygen -f /etc/ssh/ssh_host_ed25519_key -N '' -t dsa
fi

#prepare run dir
if [ ! -d "/var/run/sshd" ]; then
mkdir -p /var/run/sshd
fi
3 changes: 2 additions & 1 deletion 6.11/sshd_config
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ Port SSH_PORT
ListenAddress 0.0.0.0
LoginGraceTime 180
X11Forwarding yes
Ciphers aes128-cbc,3des-cbc,aes256-cbc
Ciphers aes128-cbc,3des-cbc,aes256-cbc,aes128-ctr,aes192-ctr,aes256-ctr
MACs hmac-sha1,hmac-sha1-96
StrictModes yes
SyslogFacility DAEMON
PasswordAuthentication yes
PermitEmptyPasswords no
PermitRootLogin yes
Subsystem sftp internal-sftp
4 changes: 2 additions & 2 deletions 6.11/startup/default-static-site.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ var server = express();
var options = {
index: 'hostingstart.html'
};
server.use('/', express.static('/home/site/wwwroot', options));
server.listen(process.env.PORT);
server.use('/', express.static('/opt/startup', options));
server.listen(process.env.PORT);
34 changes: 26 additions & 8 deletions 6.11/startup/init_container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,41 @@ A P P S E R V I C E O N L I N U X

Documentation: http://aka.ms/webapp-linux
NodeJS quickstart: https://aka.ms/node-qs
NodeJS Version : `node --version`

EOL
cat /etc/motd

sed -i "s/SSH_PORT/$SSH_PORT/g" /etc/ssh/sshd_config
service ssh start

mkdir "$PM2HOME"
chmod 777 "$PM2HOME"
ln -s /home/LogFiles "$PM2HOME"/logs

# Get environment variables to show up in SSH session
eval $(printenv | awk -F= '{print "export " $1"="$2 }' >> /etc/profile)
eval $(printenv | sed -n "s/^\([^=]\+\)=\(.*\)$/export \1=\2/p" | sed 's/"/\\\"/g' | sed '/=/s//="/' | sed 's/$/"/' >> /etc/profile)

# starting sshd process
sed -i "s/SSH_PORT/$SSH_PORT/g" /etc/ssh/sshd_config
/usr/sbin/sshd

STARTUP_COMMAND_PATH="/opt/startup/startup.sh"
ORYX_ARGS="-appPath /home/site/wwwroot -output $STARTUP_COMMAND_PATH -usePM2 -defaultApp=/opt/startup/default-static-site.js -userStartupCommand '$@'"

if [ "$APPSVC_REMOTE_DEBUGGING" = "TRUE" ]; then
ORYX_ARGS="-remoteDebug -debugPort $APPSVC_TUNNEL_PORT $ORYX_ARGS"
elif [ "$APPSVC_REMOTE_DEBUGGING_BREAK" = "TRUE" ]; then
ORYX_ARGS="-remoteDebugBrk -debugPort $APPSVC_TUNNEL_PORT $ORYX_ARGS"
fi

if [ -f "oryx-manifest.toml" ] && [ "$APPSVC_RUN_ZIP" = "TRUE" ]; then
# NPM adds the current directory's node_modules/.bin folder to PATH before it runs, so commands in
# "npm start" can files there. Since we move node_modules, we have to add it to the path ourselves.
echo 'Fixing up path'
export PATH=/node_modules/.bin:$PATH
echo "$PATH"
fi

echo "$@" > /opt/startup/startupCommand
node /opt/startup/generateStartupCommand.js
eval oryx $ORYX_ARGS

STARTUPCOMMAND=$(cat /opt/startup/startupCommand)
STARTUPCOMMAND=$(cat $STARTUP_COMMAND_PATH)
echo "Running $STARTUPCOMMAND"
eval "exec $STARTUPCOMMAND"
$STARTUP_COMMAND_PATH
29 changes: 19 additions & 10 deletions 6.2/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
FROM oryxprod/node-6.2:20190301.2

FROM mcr.microsoft.com/oryx/node-6.2:20190508.1
LABEL maintainer="Azure App Services Container Images <[email protected]>"

COPY startup /opt/startup
COPY hostingstart.html /home/site/wwwroot/hostingstart.html
RUN echo "ipv6" >> /etc/modules

RUN npm install -g pm2 \
&& mkdir -p /home/LogFiles \
&& mkdir -p /home/LogFiles /opt/startup \
&& echo "root:Docker!" | chpasswd \
&& echo "cd /home" >> /etc/bash.bashrc \
&& apt update \
&& apt install -y --no-install-recommends openssh-server vim curl wget tcptraceroute \
&& cd /opt/startup \
&& npm install \
&& chmod 755 /opt/startup/init_container.sh
&& apt-get update \
&& apt-get install --yes --no-install-recommends openssh-server vim curl wget tcptraceroute openrc

# setup default site
RUN rm -f /etc/ssh/sshd_config
COPY startup /opt/startup
COPY hostingstart.html /opt/startup

# configure startup
RUN mkdir -p /tmp
COPY sshd_config /etc/ssh/

COPY ssh_setup.sh /tmp
RUN chmod -R +x /opt/startup \
&& chmod -R +x /tmp/ssh_setup.sh \
&& (sleep 1;/tmp/ssh_setup.sh 2>&1 > /dev/null) \
&& rm -rf /tmp/* \
&& cd /opt/startup \
&& npm install

ENV PORT 8080
ENV SSH_PORT 2222
EXPOSE 2222 8080
Expand Down
26 changes: 26 additions & 0 deletions 6.2/ssh_setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/sh

if [ ! -f "/etc/ssh/ssh_host_rsa_key" ]; then
# generate fresh rsa key
ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa
fi

if [ ! -f "/etc/ssh/ssh_host_dsa_key" ]; then
# generate fresh dsa key
ssh-keygen -f /etc/ssh/ssh_host_dsa_key -N '' -t dsa
fi

if [ ! -f "/etc/ssh/ssh_host_ecdsa_key" ]; then
# generate fresh ecdsa key
ssh-keygen -f /etc/ssh/ssh_host_ecdsa_key -N '' -t dsa
fi

if [ ! -f "/etc/ssh/ssh_host_ed25519_key" ]; then
# generate fresh ecdsa key
ssh-keygen -f /etc/ssh/ssh_host_ed25519_key -N '' -t dsa
fi

#prepare run dir
if [ ! -d "/var/run/sshd" ]; then
mkdir -p /var/run/sshd
fi
3 changes: 2 additions & 1 deletion 6.2/sshd_config
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ Port SSH_PORT
ListenAddress 0.0.0.0
LoginGraceTime 180
X11Forwarding yes
Ciphers aes128-cbc,3des-cbc,aes256-cbc
Ciphers aes128-cbc,3des-cbc,aes256-cbc,aes128-ctr,aes192-ctr,aes256-ctr
MACs hmac-sha1,hmac-sha1-96
StrictModes yes
SyslogFacility DAEMON
PasswordAuthentication yes
PermitEmptyPasswords no
PermitRootLogin yes
Subsystem sftp internal-sftp
4 changes: 2 additions & 2 deletions 6.2/startup/default-static-site.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ var server = express();
var options = {
index: 'hostingstart.html'
};
server.use('/', express.static('/home/site/wwwroot', options));
server.listen(process.env.PORT);
server.use('/', express.static('/opt/startup', options));
server.listen(process.env.PORT);
Loading