Skip to content

Commit a9bdadc

Browse files
authored
Merge pull request #34 from aptalca/code-server-powershell-initial
code-server-powershell: initial release
2 parents f4cb91a + 77e7a3b commit a9bdadc

File tree

7 files changed

+46
-74
lines changed

7 files changed

+46
-74
lines changed

.travis.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ language: shell
44

55
branches:
66
only:
7-
- <baseimagename>-<modname> #replace variables, omit brackets
7+
- code-server-powershell
88

99
services:
1010
- docker
1111

1212
env:
1313
global:
14-
- DOCKERHUB="linuxserver/mods" #don't modify
15-
- BASEIMAGE="baseimagename" #replace
16-
- MODNAME="modname" #replace
14+
- DOCKERHUB="linuxserver/mods"
15+
- BASEIMAGE="code-server"
16+
- MODNAME="powershell"
1717

1818
jobs:
1919
include:
@@ -25,11 +25,13 @@ jobs:
2525
- stage: BuildImage
2626
if: (NOT (type IN (pull_request)))
2727
script:
28+
# Set version
29+
- PS_VERSION=$(curl -sX GET "https://api.github.com/repos/PowerShell/PowerShell/releases/latest" | awk '/tag_name/{print $4;exit}' FS='[""]' | awk '{print substr($1,2); }')
2830
# Build image
29-
- docker build --no-cache -t ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${TRAVIS_COMMIT} .
30-
- docker tag ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${TRAVIS_COMMIT} ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}
31+
- docker build --no-cache --build-arg PS_VERSION=${PS_VERSION} -t ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${PS_VERSION}-${TRAVIS_COMMIT} .
32+
- docker tag ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${PS_VERSION}-${TRAVIS_COMMIT} ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}
3133
# Login to DockerHub
3234
- echo $DOCKERPASS | docker login -u $DOCKERUSER --password-stdin
3335
# Push all of the tags
34-
- docker push ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${TRAVIS_COMMIT}
36+
- docker push ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${PS_VERSION}-${TRAVIS_COMMIT}
3537
- docker push ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}

Dockerfile

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,25 @@
1+
FROM lsiobase/alpine:3.11 as buildstage
2+
3+
ARG PS_VERSION
4+
5+
RUN \
6+
apk add --no-cache \
7+
curl && \
8+
if [ -z ${PS_VERSION+x} ]; then \
9+
PS_VERSION=$(curl -sX GET "https://api.github.com/repos/PowerShell/PowerShell/releases/latest" \
10+
| awk '/tag_name/{print $4;exit}' FS='[""]' | awk '{print substr($1,2); }'); \
11+
fi && \
12+
mkdir -p /root-layer && \
13+
curl -o \
14+
/root-layer/powershell.deb -L \
15+
"https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/powershell_${PS_VERSION}-1.ubuntu.18.04_amd64.deb"
16+
17+
COPY root/ /root-layer/
18+
19+
# runtime stage
120
FROM scratch
221

3-
# copy local files
4-
COPY root/ /
22+
LABEL maintainer="aptalca"
23+
24+
# Add files from buildstage
25+
COPY --from=buildstage /root-layer/ /

Dockerfile.complex

Lines changed: 0 additions & 21 deletions
This file was deleted.

README.md

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,7 @@
1-
# Rsync - Docker mod for openssh-server
1+
# PowerShell - Docker mod for code-server
22

3-
This mod adds rsync to openssh-server, to be installed/updated during container start.
3+
This mod adds PowerShell to code-server, to be installed/updated during container start.
44

5-
In openssh-server docker arguments, set an environment variable `DOCKER_MODS=linuxserver/mods:openssh-server-rsync`
5+
In code-server docker arguments, set an environment variable `DOCKER_MODS=linuxserver/mods:code-server-powershell`
66

7-
If adding multiple mods, enter them in an array separated by `|`, such as `DOCKER_MODS=linuxserver/mods:openssh-server-rsync|linuxserver/mods:openssh-server-mod2`
8-
9-
# Mod creation instructions
10-
11-
* Ask the team to create a new branch named `<baseimagename>-<modname>`. Baseimage should be the name of the image the mod will be applied to. The new branch will be based on the `template` branch.
12-
* Fork the repo, checkout the newly created branch.
13-
* Edit the `Dockerfile` for the mod. `Dockerfile.complex` is only an example and included for reference; it should be deleted when done.
14-
* Inspect the `root` folder contents. Edit, add and remove as necessary.
15-
* Edit this readme with pertinent info, delete these instructions.
16-
* Finally edit the `travis.yml`. Customize the build branch, and the vars for `BASEIMAGE` and `MODNAME`.
17-
* Submit PR against the branch created by the team.
7+
If adding multiple mods, enter them in an array separated by `|`, such as `DOCKER_MODS=linuxserver/mods:code-server-powershell|linuxserver/mods:code-server-mod2`

root/etc/cont-init.d/98-powershell

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/with-contenv bash
2+
3+
if [ -f "/powershell.deb" ]; then
4+
echo "Installing PowerShell"
5+
apt-get update
6+
apt-get install -y /powershell.deb
7+
rm /powershell.deb
8+
else
9+
echo "PowerShell already installed, skipping"
10+
fi

root/etc/cont-init.d/98-vpn-config

Lines changed: 0 additions & 27 deletions
This file was deleted.

root/etc/services.d/sshvpn/run

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)