Browse Source

update base container to node 10

pull/268/head
butlerx 4 years ago
parent
commit
493f0600bf
No known key found for this signature in database GPG Key ID: B37CA765BAA89170
  1. 11
      Dockerfile
  2. 5
      docker-compose.yml
  3. 2
      package.json
  4. 14
      src/server/command/ssh.ts

11
Dockerfile

@ -1,4 +1,4 @@
FROM node:carbon-alpine as builder FROM node:dubnium-alpine as builder
RUN apk add -U build-base python RUN apk add -U build-base python
WORKDIR /usr/src/app WORKDIR /usr/src/app
COPY . /usr/src/app COPY . /usr/src/app
@ -6,7 +6,7 @@ RUN yarn && \
yarn build && \ yarn build && \
yarn install --production --ignore-scripts --prefer-offline yarn install --production --ignore-scripts --prefer-offline
FROM node:carbon-alpine FROM node:dubnium-alpine
LABEL maintainer="butlerx@notthe.cloud" LABEL maintainer="butlerx@notthe.cloud"
WORKDIR /usr/src/app WORKDIR /usr/src/app
ENV NODE_ENV=production ENV NODE_ENV=production
@ -17,6 +17,9 @@ COPY package.json /usr/src/app
COPY index.js /usr/src/app COPY index.js /usr/src/app
RUN apk add -U openssh-client sshpass && \ RUN apk add -U openssh-client sshpass && \
mkdir ~/.ssh && \ mkdir ~/.ssh && \
ssh-keyscan -H wetty-ssh >> ~/.ssh/known_hosts echo '#!/usr/bin/env sh' >> /entrypoint.sh && \
echo 'ssh-keyscan -H wetty-ssh >> ~/.ssh/known_hosts' >> /entrypoint.sh && \
echo 'node .' >> /entrypoint.sh && \
chmod +x /entrypoint.sh
ENTRYPOINT [ "node", "." ] ENTRYPOINT [ "/entrypoint.sh" ]

5
docker-compose.yml

@ -3,7 +3,7 @@ version: '3.5'
services: services:
wetty: wetty:
build: . build: .
image: butlerx/wetty image: wettyoss/wetty
container_name: wetty container_name: wetty
tty: true tty: true
working_dir: /usr/src/app working_dir: /usr/src/app
@ -13,7 +13,6 @@ services:
SSHHOST: 'wetty-ssh' SSHHOST: 'wetty-ssh'
SSHPORT: 22 SSHPORT: 22
NODE_ENV: 'development' NODE_ENV: 'development'
command: yarn start --sshhost redbrick.dcu.ie
web: web:
image: nginx image: nginx
@ -37,7 +36,7 @@ services:
build: build:
context: . context: .
dockerfile: ssh.Dockerfile dockerfile: ssh.Dockerfile
image: butlerx/wetty:ssh image: wettyoss/wetty:ssh
container_name: 'wetty-ssh' container_name: 'wetty-ssh'
networks: networks:

2
package.json

@ -45,7 +45,7 @@
"wetty": "./index.js" "wetty": "./index.js"
}, },
"engines": { "engines": {
"node": ">=6.9" "node": ">=10.22"
}, },
"nodemonConfig": { "nodemonConfig": {
"ignore": [ "ignore": [

14
src/server/command/ssh.ts

@ -3,11 +3,19 @@ import parseCommand from './parse';
import logger from '../utils/logger'; import logger from '../utils/logger';
export default function sshOptions( export default function sshOptions(
{ pass, path, command, host, port, auth, knownhosts }: { [s: string]: string }, {
pass,
path,
command,
host,
port,
auth,
knownhosts,
}: { [s: string]: string },
key?: string key?: string
): string[] { ): string[] {
const cmd = parseCommand(command, path); const cmd = parseCommand(command, path);
const hostChecking = (knownhosts !== '/dev/null') ? 'yes' : 'no' const hostChecking = knownhosts !== '/dev/null' ? 'yes' : 'no';
const sshRemoteOptsBase = [ const sshRemoteOptsBase = [
'ssh', 'ssh',
host, host,
@ -18,7 +26,7 @@ export default function sshOptions(
`PreferredAuthentications=${auth}`, `PreferredAuthentications=${auth}`,
'-o', '-o',
`UserKnownHostsFile=${knownhosts}`, `UserKnownHostsFile=${knownhosts}`,
'-o', '-o',
`StrictHostKeyChecking=${hostChecking}`, `StrictHostKeyChecking=${hostChecking}`,
]; ];
logger.info(`Authentication Type: ${auth}`); logger.info(`Authentication Type: ${auth}`);

Loading…
Cancel
Save