Skip to content

Commit e507b4e

Browse files
committed
feat(docker): create image for gitpod
1 parent 9ada09d commit e507b4e

File tree

2 files changed

+76
-11
lines changed

2 files changed

+76
-11
lines changed

.github/workflows/docker--ghcr.yml

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,44 @@ jobs:
1818
strategy:
1919
fail-fast: false
2020
matrix:
21-
images: [landing]
21+
images:
22+
- landing
23+
- gitpod-fcc
2224

2325
steps:
2426
- name: Checkout code
25-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
27+
uses: actions/checkout@v4
2628

2729
- name: Set up Docker Buildx
28-
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3
30+
uses: docker/setup-buildx-action@v3
2931

3032
- name: Log in to the GHCR
31-
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3
33+
uses: docker/login-action@v3
3234
with:
3335
registry: ghcr.io
3436
username: ${{ github.actor }}
3537
password: ${{ secrets.GITHUB_TOKEN }}
3638

39+
- name: Cache Docker layers
40+
uses: actions/cache@v3
41+
with:
42+
path: /tmp/.buildx-cache
43+
key: ${{ runner.os }}-buildx-${{ matrix.images }}-${{ github.sha }}
44+
restore-keys: |
45+
${{ runner.os }}-buildx-${{ matrix.images }}-
46+
3747
- name: Build and push Docker image
48+
uses: docker/build-push-action@v5
49+
with:
50+
context: ./docker/${{ matrix.images }}
51+
push: true
52+
tags: |
53+
ghcr.io/freecodecamp/${{ matrix.images }}:${{ github.sha }}
54+
ghcr.io/freecodecamp/${{ matrix.images }}:latest
55+
cache-from: type=local,src=/tmp/.buildx-cache
56+
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
57+
58+
- name: Move cache
3859
run: |
39-
cd docker/${{ matrix.images }}
40-
41-
docker build . \
42-
--tag ghcr.io/freecodecamp/${{ matrix.images }}:${{ github.sha }} \
43-
--tag ghcr.io/freecodecamp/${{ matrix.images }}:latest
44-
45-
docker push --all-tags ghcr.io/freecodecamp/${{ matrix.images }}
60+
rm -rf /tmp/.buildx-cache
61+
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

docker/gitpod-fcc/Dockerfile

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
FROM gitpod/workspace-mongodb:latest
2+
3+
LABEL org.opencontainers.image.source=https://github.com/freecodecamp/infra
4+
LABEL org.opencontainers.image.description="A Gitpod image for the freeCodeCamp.org main repo."
5+
LABEL org.opencontainers.image.licenses=BSD-3-Clause
6+
7+
RUN sudo install-packages \
8+
ca-certificates \
9+
fonts-liberation \
10+
libappindicator3-1 \
11+
libatk-bridge2.0-0 \
12+
libatk1.0-0 \
13+
libc6 \
14+
libcairo2 \
15+
libcups2 \
16+
libdbus-1-3 \
17+
libexpat1 \
18+
libfontconfig1 \
19+
libgbm1 \
20+
libgcc1 \
21+
libglib2.0-0 \
22+
libnspr4 \
23+
libpango-1.0-0 \
24+
libpangocairo-1.0-0 \
25+
libstdc++6 \
26+
libx11-6 \
27+
libx11-xcb1 \
28+
libxcb1 \
29+
libxcomposite1 \
30+
libxcursor1 \
31+
libxdamage1 \
32+
libxext6 \
33+
libxfixes3 \
34+
libxi6 \
35+
libxrandr2 \
36+
libxrender1 \
37+
lsb-release \
38+
wget \
39+
xdg-utils
40+
41+
# from https://www.gitpod.io/docs/introduction/languages/javascript#node-versions
42+
RUN bash -c 'VERSION="20" \
43+
&& source $HOME/.nvm/nvm.sh && nvm install $VERSION \
44+
&& nvm use $VERSION && nvm alias default $VERSION \
45+
&& npm i -g pnpm@9'
46+
47+
RUN echo "nvm use default &>/dev/null" >> ~/.bashrc.d/51-nvm-fix
48+
49+
RUN npx -y puppeteer browsers install chrome

0 commit comments

Comments
 (0)