Skip to content

Commit cfd5916

Browse files
authored
Merge pull request #49 from sugarlabs/18-docker-improve
(18) Update Docker image and GitHub container registry
2 parents af1263b + ad1dd26 commit cfd5916

File tree

9 files changed

+40
-327
lines changed

9 files changed

+40
-327
lines changed

.github/linters/.eslintrc.json

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

.github/linters/.markdownlint.jsonc

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

.github/workflows/linter.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ jobs:
5050
uses: github/super-linter@v3
5151
env:
5252
DEFAULT_BRANCH: main
53+
LINTER_RULES_PATH: /
54+
JAVASCRIPT_ES_CONFIG_FILE: .eslintrc.json
55+
TYPESCRIPT_ES_CONFIG_FILE: .eslintrc.json
56+
MARKDOWN_CONFIG_FILE: .markdownlint.jsonc
5357
VALIDATE_ALL_CODEBASE: false
5458
VALIDATE_CSS: false
5559
VALIDATE_DOCKERFILE: false

Dockerfile

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
1-
FROM debian:buster-slim
1+
# base from official Node (Alpine LTS) image
2+
FROM node:lts-alpine
23

3-
# install node.js:14.x
4-
RUN apt update --no-install-recommends -yq \
5-
&& apt-get install curl gnupg -yq \
6-
&& curl -sL https://deb.nodesource.com/setup_14.x | bash \
7-
&& apt-get install nodejs -yq \
8-
&& apt-get clean -y \
9-
&& rm -rf /var/lib/apt/lists/*
10-
11-
# update npm
12-
RUN npm install -g npm
4+
# install simple http server for serving static content
5+
RUN npm install -g http-server
136

147
# install typescript compiler
158
RUN npm install -g typescript
169

1710
# install ts-node (to run/debug .ts files without manual transpiling)
1811
RUN npm install -g ts-node
1912

20-
LABEL org.opencontainers.image.description='An initial development image based on a slimmed Debian \
21-
10.7 (buster), and further configured with Node.js v14, TypeScript compiler, and ts-node. This \
22-
does not contain any source files.'
23-
13+
# set /app as working directory (in development mode for mounting source code)
2414
WORKDIR /app
2515

26-
EXPOSE 5000 9000
16+
# override default CMD for image ("node"): launch the shell
17+
CMD sh
18+
19+
# Listen on ports
20+
EXPOSE 80 3000
21+
22+
# Add label for GitHub container registry
23+
LABEL org.opencontainers.image.description='An initial development image based on the official \
24+
Node.js (on Alpine LTS) image, and further configured with a HTTP server, TypeScript compiler, \
25+
and ts-node. This is merely to provide an execution sandbox and does not contain source files.'

README.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ Windows) this repository using
4747
4. Build _docker image_ and launch _docker network_.
4848

4949
_**Note:**_ A
50-
[built initial development image](https://github.com/orgs/sugarlabs/packages/container/musicblocks/531083)
50+
[built initial development image](https://github.com/orgs/sugarlabs/packages/container/musicblocks/2948273?tag=4.0.0-dev)
5151
has been published to
5252
[_Sugar Labs GitHub Container Registry_ (_GHCR_)](https://github.com/orgs/sugarlabs/packages?ecosystem=container),
5353
which can be pulled directly, so you don't have to build it again. Pull using
5454

5555
```bash
56-
docker pull ghcr.io/sugarlabs/musicblocks:initial
56+
docker pull ghcr.io/sugarlabs/musicblocks:4.0.0-dev
5757
```
5858

5959
Nagivate inside the project directory and launch the _docker network_ using
@@ -76,27 +76,28 @@ Windows) this repository using
7676
5. In a second terminal, run
7777
7878
```bash
79-
docker attach musicblocks
79+
docker attach musicblocks-4.0.0-dev
8080
```
8181
82-
The _Linux Debian 10.7_ (_buster_) _shell_ in the _docker container_ named _musicblocks_ is
83-
spawned and standard input/output is connected to the terminal.
82+
The _Alpine shell_ in the _docker container_ named _musicblocks-4.0.0-dev_ is spawned and
83+
standard input/output is connected to the terminal.
8484
8585
6. _**Node**_ (_Node.js Runtime_), _**npm**_ (_Node Package Manager_), _**tsc**_ (_TypeScript
86-
Compiler_), and _**ts-node**_ (_Node executable for TypeScript_) should be installed. Check
87-
using
86+
Compiler_), _**ts-node**_ (_Node executable for TypeScript_), and _**http-server**_ (_a HTTP
87+
server program_) should be installed. Check using
8888
8989
```bash
90-
node --version && npm --version && tsc --version && ts-node --version
90+
node -v && npm -v && tsc -v && ts-node -v && http-server -v
9191
```
9292
93-
in the second terminal. Output should look like
93+
Output should look like
9494
9595
```bash
96-
v14.16.1
97-
7.9.0
98-
Version 4.2.4
99-
v9.1.1
96+
v14.17.0
97+
6.14.13
98+
Version 4.3.2
99+
v10.0.0
100+
v0.12.3
100101
```
101102
102103
The steps you take from here depend on what you want to do:

0 commit comments

Comments
 (0)