Skip to content

Commit 1d79e54

Browse files
authored
Merge pull request #10 from aptalca/code-server-docker
code-server: docker initial release
2 parents ca2c0ce + affeb7e commit 1d79e54

File tree

7 files changed

+51
-71
lines changed

7 files changed

+51
-71
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-docker
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="docker"
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+
- COMPOSE_VERSION=$(curl -sX GET "https://api.github.com/repos/docker/compose/releases/latest" | awk '/tag_name/{print $4;exit}' FS='[""]')
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 COMPOSE_VERSION=${COMPOSE_VERSION} -t ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${COMPOSE_VERSION}-${TRAVIS_COMMIT} .
32+
- docker tag ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${COMPOSE_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}-${COMPOSE_VERSION}-${TRAVIS_COMMIT}
3537
- docker push ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}

Dockerfile

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,26 @@
1+
FROM lsiobase/alpine:3.11 as buildstage
2+
3+
ARG COMPOSE_VERSION
4+
5+
RUN \
6+
apk add --no-cache \
7+
curl && \
8+
if [ -z ${COMPOSE_VERSION+x} ]; then \
9+
COMPOSE_VERSION=$(curl -sX GET "https://api.github.com/repos/docker/compose/releases/latest" \
10+
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
11+
fi && \
12+
mkdir -p /root-layer && \
13+
curl -o \
14+
/root-layer/docker-compose -L \
15+
"https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-Linux-x86_64" && \
16+
chmod +x /root-layer/docker-compose
17+
18+
COPY root/ /root-layer/
19+
20+
# runtime stage
121
FROM scratch
222

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

Dockerfile.complex

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

README.md

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
1-
# Docker mod for openssh-server
1+
# Docker - 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 docker and docker-compose 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+
**IMPORTANT NOTE**: For docker access inside code-server, a volume mapping needs to be added for `/var/run/docker.sock:/var/run/docker.sock` in code-server docker run/create/compose.
66

7-
# Mod creation instructions
7+
In code-server docker arguments, set an environment variable `DOCKER_MODS=linuxserver/mods:code-server-docker` to enable.
88

9-
* 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.
10-
* Fork the repo, checkout the template branch.
11-
* Edit the `Dockerfile` for the mod. `Dockerfile.complex` is only an example and included for reference; it should be deleted when done.
12-
* Inspect the `root` folder contents. Edit, add and remove as necessary.
13-
* Edit this readme with pertinent info, delete thse instructions.
14-
* Finally edit the `travis.yml`. Customize the build branch,and the vars for `BASEIMAGE` and `MODNAME`
15-
* Submit PR against the branch created by the team
9+
If adding multiple mods, enter them in an array separated by `|`, such as `DOCKER_MODS=linuxserver/mods:code-server-docker|linuxserver/mods:code-server-mod2`

root/etc/cont-init.d/99-docker

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/with-contenv bash
2+
3+
echo "**** installing docker environment ****"
4+
if ! dpkg -l | grep gnupg > /dev/null; then
5+
apt-get update && apt-get install -y gnupg
6+
fi
7+
[[ ! -f "/etc/apt/sources.list.d/docker-ce.list" ]] && \
8+
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - && \
9+
source /etc/os-release && \
10+
echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu $UBUNTU_CODENAME stable" > /etc/apt/sources.list.d/docker-ce.list
11+
apt-get update && apt-get install -y --no-install-recommends \
12+
docker-ce
13+
usermod -aG docker abc

root/etc/cont-init.d/99-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)