Skip to content

Commit d5dc845

Browse files
committed
initial
1 parent 7fff0d5 commit d5dc845

7 files changed

Lines changed: 156 additions & 0 deletions

File tree

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/
2+
.git/
3+
.github/

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
config.ini.php eol=lf

.github/workflows/publish.yaml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Create and publish a Docker image
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
workflow_dispatch:
8+
9+
env:
10+
REGISTRY: ghcr.io
11+
IMAGE_NAME: ${{ github.repository }}
12+
13+
jobs:
14+
build-and-push-image:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
packages: write
18+
contents: write # to be able to publish a GitHub release
19+
issues: write # to be able to comment on released issues
20+
pull-requests: write # to be able to comment on released pull requests
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v3
25+
26+
- uses: actions/setup-node@v1
27+
with:
28+
node-version: 18
29+
30+
- uses: codfish/semantic-release-action@v2
31+
id: semantic
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
35+
- name: Log in to the Container registry
36+
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
37+
with:
38+
registry: ${{ env.REGISTRY }}
39+
username: ${{ github.actor }}
40+
password: ${{ secrets.GITHUB_TOKEN }}
41+
42+
- name: Extract metadata (tags, labels) for Docker
43+
id: meta
44+
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
45+
with:
46+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
47+
tags: |
48+
type=schedule
49+
type=raw,value=latest,enable={{is_default_branch}}
50+
type=ref,event=branch
51+
type=ref,event=tag
52+
type=ref,event=pr
53+
type=raw,value=v${{ steps.semantic.outputs.release-version }},enable=${{steps.semantic.outputs.new-release-published == 'true'}}
54+
55+
- name: Build and push Docker image
56+
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
57+
with:
58+
context: .
59+
push: true
60+
tags: ${{ steps.meta.outputs.tags }}
61+
labels: ${{ steps.meta.outputs.labels }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/

Dockerfile

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
FROM linuxserver/code-server:4.14.0@sha256:8c76533b90b5380f8ee17668c1ba7acf5974a1ab4ffe64c015350d38fb3e810c
2+
SHELL ["/bin/bash", "-eo", "pipefail", "-c"]
3+
4+
RUN \
5+
apt-get -y update && \
6+
LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
7+
# Used to download binaries (implies the package "ca-certificates" as a dependency)
8+
curl \
9+
# Dev. Tooling packages (e.g. tools provided by this image installable through Alpine Linux Packages)
10+
git \
11+
make \
12+
build-essential \
13+
jq \
14+
zip \
15+
# python
16+
python3 \
17+
python3-pip \
18+
gpg \
19+
lsb-release \
20+
# Required for building Ruby
21+
libssl-dev libreadline-dev zlib1g-dev \
22+
# Required for some of the ruby gems that will be installed
23+
libyaml-dev libncurses5-dev libffi-dev libgdbm-dev \
24+
&& \
25+
apt-get clean &&\
26+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
27+
28+
# Install ASDF to install custom tools
29+
ARG ASDF_VERSION=0.11.3
30+
RUN bash -c "git clone https://github.com/asdf-vm/asdf.git $HOME/.asdf --branch v${ASDF_VERSION} && \
31+
echo 'legacy_version_file = yes' > $HOME/.asdfrc && \
32+
printf 'yarn\njsonlint' > $HOME/.default-npm-packages && \
33+
. $HOME/.asdf/asdf.sh && \
34+
asdf plugin add ruby https://github.com/asdf-vm/asdf-ruby.git && \
35+
asdf install ruby 3.2.2 && \
36+
asdf global ruby 3.2.2 && \
37+
asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git && \
38+
asdf install nodejs 18.15.0 && \
39+
asdf global nodejs 18.15.0 && \
40+
asdf plugin add java https://github.com/halcyon/asdf-java.git && \
41+
asdf install java zulu-17.42.19 && \
42+
asdf global java zulu-17.42.19"
43+
44+
COPY ./entrypoint.sh /entrypoint.sh
45+
RUN chmod a+x /entrypoint.sh
46+
47+
ENTRYPOINT ["/entrypoint.sh"]

Makefile

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!make
2+
.DEFAULT_GOAL := build
3+
4+
REGISTRY := jenkins
5+
NAME := code-server
6+
VERSION := latest
7+
NAME_VERSION := $(NAME):$(VERSION)
8+
TAGNAME := $(REGISTRY)/$(NAME_VERSION)
9+
10+
.PHONY: version
11+
version: ## Show the current image version
12+
@echo Image: $(TAGNAME)
13+
14+
.PHONY: build
15+
build: ## Build docker image
16+
docker build -t $(TAGNAME) .
17+
18+
.PHONY: push
19+
push: ## push to docker hub
20+
docker push $(TAGNAME)
21+
22+
.PHONY: push
23+
kill: ## kill the running process
24+
docker kill $(NAME)
25+
26+
.SHELL := /bin/bash
27+
.PHONY: run
28+
run: ## run the docker hub
29+
docker run \
30+
-it \
31+
--rm \
32+
-p 3000:3000 \
33+
--name $(NAME) \
34+
$(TAGNAME)
35+
36+
.PHONY: help
37+
help:
38+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

entrypoint.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
. $HOME/.asdf/asdf.sh
4+
5+
exec /init "$@"

0 commit comments

Comments
 (0)