Skip to content

Commit 3ba4b8e

Browse files
authored
Merge pull request #11 from ptr727/develop
Develop
2 parents 54f61f5 + 5bf557a commit 3ba4b8e

File tree

5 files changed

+77
-112
lines changed

5 files changed

+77
-112
lines changed
Lines changed: 7 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
name: 'Build and Publish Docker Images'
22

3-
env:
4-
# Push main branch only, else just build
5-
DOCKER_PUSH: ${{ github.ref == 'refs/heads/main' }}
6-
73
on:
84
push:
95
branches: [main, develop]
@@ -15,6 +11,7 @@ on:
1511
- cron: "0 2 * * MON"
1612

1713
jobs:
14+
1815
build:
1916
name: 'Build and Publish Docker Images'
2017
runs-on: ubuntu-latest
@@ -28,6 +25,8 @@ jobs:
2825
# https://github.com/marketplace/actions/docker-setup-qemu
2926
- name: 'Setup QEMU'
3027
uses: docker/setup-qemu-action@v2
28+
with:
29+
platforms: linux/amd64,linux/arm64,linux/arm/v7
3130

3231
# https://github.com/marketplace/actions/docker-setup-buildx
3332
- name: 'Setup Docker Buildx'
@@ -41,40 +40,10 @@ jobs:
4140
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
4241

4342
# https://github.com/marketplace/actions/build-and-push-docker-images
44-
45-
# .NET 6.0
46-
- name: 'Build and Push .NET 6.0'
47-
uses: docker/build-push-action@v4
48-
with:
49-
platforms: linux/amd64
50-
push: ${{ env.DOCKER_PUSH }}
51-
tags: |
52-
ptr727/vscode-server-dotnetcore:6.0
53-
build-args: |
54-
LABEL_VERSION=6.0
55-
INSTALL_VERSION=dotnet-sdk-6.0
56-
57-
# .NET 7.0
58-
- name: 'Build and Push .NET 7.0'
59-
uses: docker/build-push-action@v4
60-
with:
61-
platforms: linux/amd64
62-
push: ${{ env.DOCKER_PUSH }}
63-
tags: |
64-
ptr727/vscode-server-dotnetcore:7.0
65-
build-args: |
66-
LABEL_VERSION=7.0
67-
INSTALL_VERSION=dotnet-sdk-7.0
68-
69-
# .NET 6.0 and .NET 7.0
70-
- name: 'Build and Push .NET 6.0 and .NET 7.0'
43+
- name: 'Build and Push .NET LTS and STS'
7144
uses: docker/build-push-action@v4
7245
with:
73-
platforms: linux/amd64
74-
push: ${{ env.DOCKER_PUSH }}
46+
platforms: linux/amd64,linux/arm64,linux/arm/v7
47+
push: ${{ (github.event_name != 'pull_request') }}
7548
tags: |
76-
ptr727/vscode-server-dotnetcore:latest
77-
ptr727/vscode-server-dotnetcore:60.70
78-
build-args: |
79-
LABEL_VERSION=60.70
80-
"INSTALL_VERSION=dotnet-sdk-6.0 dotnet-sdk-7.0"
49+
ptr727/vscode-server-dotnetcore:${{ endsWith(github.ref, 'refs/heads/main') && 'latest' || 'develop' }}

.github/workflows/DockerHubDescription.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,13 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414

15-
# https://github.com/actions/checkout
15+
# https://github.com/marketplace/actions/checkout
1616
- name: 'Checkout Code'
17-
uses: actions/checkout@v2
17+
uses: actions/checkout@v3
1818

1919
# https://github.com/marketplace/actions/docker-hub-description
20-
# Access tokens cannot update readme.md, we have to use the real password
2120
- name: 'Update Docker Hub Description'
22-
uses: peter-evans/dockerhub-description@v2
21+
uses: peter-evans/dockerhub-description@v3
2322
with:
2423
username: ${{ secrets.DOCKER_HUB_USERNAME }}
2524
password: ${{ secrets.DOCKER_HUB_PASSWORD }}

Dockerfile

Lines changed: 54 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,75 @@
1-
# Test in docker shell:
1+
# Test base image in shell:
22
# docker run -it --rm --pull always --name Testing lscr.io/linuxserver/code-server:latest /bin/bash
33
# export DEBIAN_FRONTEND=noninteractive
44

5+
# Test image in shell:
6+
# docker run -it --rm --pull always --name Testing ptr727/vscode-server-dotnetcore:develop /bin/bash
7+
8+
# Build Dockerfile
9+
# docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 --tag testing:latest .
10+
11+
# Test linux/amd64 target
12+
# docker buildx build --load --progress plain --no-cache --platform linux/amd64 --tag testing:latest .
13+
# docker run -it --rm --name Testing testing:latest /bin/bash
14+
15+
16+
517
# https://github.com/linuxserver/docker-code-server
618
FROM lscr.io/linuxserver/code-server:latest
719

20+
# Image label
21+
# TODO: Get current STS and LTS versions dynamically
822
ARG LABEL_VERSION="60.70"
9-
ARG INSTALL_VERSION="dotnet-sdk-6.0 dotnet-sdk-7.0"
10-
1123
LABEL name="VSCode-Server-DotNet" \
1224
version=${LABEL_VERSION} \
13-
description="VSCode Server with .NET Core SDK and PowerShell Pre-Installed" \
25+
description="VSCode Server with .NET SDK Pre-Installed" \
1426
maintainer="Pieter Viljoen <ptr727@users.noreply.github.com>"
1527

16-
# Enable .NET detection of running in a container
17-
# See: https://github.com/dotnet/dotnet-docker/blob/master/3.0/sdk/bionic/amd64/Dockerfile
28+
# See: https://github.com/dotnet/dotnet-docker/blob/main/src/sdk/7.0/jammy/amd64/Dockerfile
1829
ENV DOTNET_RUNNING_IN_CONTAINER=true \
1930
# Enable correct mode for dotnet watch (only mode supported in a container)
2031
DOTNET_USE_POLLING_FILE_WATCHER=true \
2132
# Skip extraction of XML docs - generally not useful within an image/container - helps performance
2233
NUGET_XMLDOC_MODE=skip \
34+
# Do not show first run text
35+
DOTNET_NOLOGO=true \
36+
# Unset ASPNETCORE_URLS from aspnet base image
37+
ASPNETCORE_URLS= \
38+
# Do not generate certificate
39+
DOTNET_GENERATE_ASPNET_CERTIFICATE=false \
2340
# No installer frontend interaction
2441
DEBIAN_FRONTEND=noninteractive
2542

26-
RUN apt-get update \
27-
# Install pre-requisites
28-
&& apt-get install -y wget apt-transport-https software-properties-common \
29-
# Register the Microsoft repository
30-
&& wget https://packages.microsoft.com/config/ubuntu/$(lsb_release -sr)/packages-microsoft-prod.deb \
31-
&& dpkg -i packages-microsoft-prod.deb \
32-
&& rm packages-microsoft-prod.deb \
33-
&& touch /etc/apt/preferences \
34-
&& echo "Package: *" >> /etc/apt/preferences \
35-
&& echo "Pin: origin \"packages.microsoft.com\"" >> /etc/apt/preferences \
36-
&& echo "Pin-Priority: 1001" >> /etc/apt/preferences \
37-
&& cat /etc/apt/preferences \
38-
&& cat /etc/apt/sources.list.d/microsoft-prod.list \
39-
# Update
40-
&& apt-get update \
41-
&& apt-get upgrade -y \
42-
# Install .NET SDK and PowerShell
43-
# https://docs.microsoft.com/en-us/dotnet/core/install/linux-ubuntu
44-
# https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-linux
45-
&& apt-get install -y ${INSTALL_VERSION} powershell \
46-
&& dotnet --info \
43+
# Prerequisites
44+
# https://learn.microsoft.com/en-us/dotnet/core/install/linux-ubuntu#dependencies
45+
RUN apt-get update && apt-get upgrade -y \
46+
&& apt-get install -y --no-install-recommends \
47+
libc6 \
48+
libgcc1 \
49+
libgcc-s1 \
50+
libgssapi-krb5-2 \
51+
libicu70 \
52+
liblttng-ust1 \
53+
libssl3 \
54+
libstdc++6 \
55+
libunwind8 \
56+
wget \
57+
zlib1g \
58+
&& apt-get clean \
59+
&& rm -rf /var/lib/apt/lists/*
60+
61+
# TODO: What is preferred way to set the root and get in path?
62+
ENV DOTNET_ROOT=/usr/share/dotnet
63+
ENV DOTNET_CLI_HOME=/usr/share/dotnet
64+
65+
# Install .NET
66+
# https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script
67+
RUN wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh \
68+
&& chmod +x ./dotnet-install.sh \
69+
&& ./dotnet-install.sh --install-dir /usr/share/dotnet --version latest --channel LTS\
70+
&& ./dotnet-install.sh --install-dir /usr/share/dotnet --version latest --channel STS\
71+
&& ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet \
72+
&& dotnet --list-runtimes \
73+
&& dotnet --list-sdks \
4774
&& apt-get clean \
4875
&& rm -rf /var/lib/apt/lists/*

README.md

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# VSCode Server with .NET Core SDK and PowerShell Pre-Installed
1+
# VSCode Server with .NET Pre-Installed
22

3-
This is a docker image of VSCode Server with the .NET SDK and PowerShell pre-installed.
3+
This is a docker image of VSCode Server with the .NET LTS and STS SDK's pre-installed.
44
Docker image is based on [LinuxServer.io Code-Server](https://github.com/linuxserver/docker-code-server), which is based on [Coder.com Code-Server](https://github.com/cdr/code-server).
55

66
## License
@@ -9,39 +9,29 @@ Docker image is based on [LinuxServer.io Code-Server](https://github.com/linuxse
99

1010
## Build Status
1111

12-
[Code and Pipline is on GitHub](https://github.com/ptr727/VSCode-Server-DotNetCore):
12+
[Code and Pipeline is on GitHub](https://github.com/ptr727/VSCode-Server-DotNetCore):
1313
![GitHub Last Commit](https://img.shields.io/github/last-commit/ptr727/VSCode-Server-DotNetCore?logo=github)
1414
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/ptr727/VSCode-Server-DotNetCore/BuildPublishPipeline.yml?logo=github)
1515

1616
## Container Images
1717

1818
Docker container images are published on [Docker Hub](https://hub.docker.com/r/ptr727/vscode-server-dotnetcore).
19-
Images are tagged using `latest`, `6.0`, and `7.0`.
20-
`latest` includes .NET 6.0 and .NET 7.0.
21-
Images are automatically rebuilt every Monday morning, picking up the latest updates.
19+
Multi-Architecture images are created for `linux/amd64`, `linux/arm64`, and `linux/arm/v7`.
20+
Tags are `latest` for `main` branch and `develop` for `develop` branch.
21+
E.g. `docker pull ptr727/vscode-server-dotnetcore:latest`
22+
E.g. `docker pull ptr727/vscode-server-dotnetcore:develop`
23+
24+
Builds include the LTS and STS [supported versions](https://dotnet.microsoft.com/en-us/platform/support/policy/dotnet-core) of .NET SDK's.
25+
Currently .NET 6.0 and .NET 7.0.
26+
27+
Images are automatically rebuilt every Monday morning, picking up the latest upstream updates.
2228
![Docker Pulls](https://img.shields.io/docker/pulls/ptr727/vscode-server-dotnetcore?logo=docker)
2329
![Docker Image Version](https://img.shields.io/docker/v/ptr727/vscode-server-dotnetcore/latest?logo=docker)
2430

2531
## Usage
2632

2733
Follow the [linuxserver/code-server](https://github.com/linuxserver/docker-code-server) instructions.
2834

29-
## Background Info
30-
31-
- [DotNet in Docker](https://github.com/dotnet/dotnet-docker/blob/master/3.0/sdk/bionic/amd64/Dockerfile)
32-
- [LSIO Code Server Docker](https://github.com/linuxserver/docker-code-server/blob/master/Dockerfile)
33-
- [Coder Code Server Docker](https://github.com/cdr/code-server/blob/master/Dockerfile)
34-
- [DotNet install](https://docs.microsoft.com/en-us/dotnet/core/install/linux-package-manager-ubuntu-1804)
35-
- [PowerShell install](https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-linux?view=powershell-7#ubuntu-1804)
36-
- [Package Manager](https://dotnet.microsoft.com/download/linux-package-manager/ubuntu18-04/sdk-current)
37-
3835
## Notes
3936

40-
- .NET 5 and .NET Core 3.1 and older are [no longer supported](https://learn.microsoft.com/en-us/dotnet/core/install/linux-ubuntu) on Ubuntu Jammy.
41-
- codercom/code-server runs as root, not permission friendly when mapping volumes.
42-
- linuxserver/code-server allows specifying PUID and GUID, ideal when using mapped volumes in e.g. UnRaid.
43-
- Use `cat /etc/*-release` to determine the base image, installed packages must match the base image.
44-
- Run DotNet Core by `dotnet` in the console.
45-
- Run PowerShell by `pwsh` in the console.
46-
- If installing PowerShell Core Preview use `powershell-preview` and `pwsh-preview` to launch.
47-
- An alternative to building on top of the LSIO image, is to use a [dynamic overlay](https://blog.linuxserver.io/2019/09/14/customizing-our-containers/).
37+
- When Multi-Arch image support was added, PowerShell was removed because installing it on all platforms was non-trivial. Let me know if you really need it, and I'll reinvestigate.

docker-compose.yml

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

0 commit comments

Comments
 (0)