Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🛠 Make automatically recognize new versions #3

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions .github/workflows/docker-build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,23 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Get latest code-server version
id: get_version
run: |
VERSION=$(curl -sX GET https://api.github.com/repos/coder/code-server/releases/latest \
| awk '/tag_name/{print $4;exit}' FS='[""]' | sed 's|^v||')
echo "::set-output name=version::$VERSION"

- name: Build and push amd64 image
uses: docker/build-push-action@v2
with:
file: ./amd64/Dockerfile
context: .
platforms: linux/amd64
push: true
tags: martinussuherman/alpine-code-server:3.12.0-alpine3.13-amd64, martinussuherman/alpine-code-server:3.12.0-alpine3.13, martinussuherman/alpine-code-server:latest
tags: |
martinussuherman/alpine-code-server:${{ steps.get_version.outputs.version }}-amd64
martinussuherman/alpine-code-server:latest

- name: Build and push arm64v8 image
uses: docker/build-push-action@v2
Expand All @@ -39,4 +48,4 @@ jobs:
context: .
platforms: linux/arm64
push: true
tags: martinussuherman/alpine-code-server:3.12.0-alpine3.13-arm64v8
tags: martinussuherman/alpine-code-server:${{ steps.get_version.outputs.version }}-arm64v8
2 changes: 1 addition & 1 deletion .github/workflows/snyk-docker-amd64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ jobs:
args: --file=amd64/Dockerfile

- name: Upload result to GitHub Code Scanning
uses: github/codeql-action/upload-sarif@v1
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: snyk.sarif
22 changes: 10 additions & 12 deletions amd64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ ENV \
# should user shell set to nologin? (yes/no) \
ENOLOGIN=no \
# container user home dir \
EHOME=/home/vscode \
# code-server version \
VERSION=3.12.0
EHOME=/home/vscode

COPY code-server /usr/bin/
RUN chmod +x /usr/bin/code-server
Expand All @@ -29,15 +27,15 @@ RUN \
nodejs \
openssh-client

RUN \
wget https://github.com/cdr/code-server/releases/download/v$VERSION/code-server-$VERSION-linux-amd64.tar.gz && \
tar x -zf code-server-$VERSION-linux-amd64.tar.gz && \
rm code-server-$VERSION-linux-amd64.tar.gz && \
rm code-server-$VERSION-linux-amd64/node && \
rm code-server-$VERSION-linux-amd64/code-server && \
rm code-server-$VERSION-linux-amd64/lib/node && \
mv code-server-$VERSION-linux-amd64 /usr/lib/code-server && \
sed -i 's/"$ROOT\/lib\/node"/node/g' /usr/lib/code-server/bin/code-server
RUN \
export VERSION=$(curl -sX GET https://api.github.com/repos/coder/code-server/releases/latest | awk '/tag_name/{print $4;exit}' FS='[""]' | sed 's|^v||') && \
echo "******************" && \
echo "Version : $VERSION" && \
echo "******************" && \
curl -fsSL -o code-server-${VERSION}-linux-amd64.tar.gz https://github.com/coder/code-server/releases/download/v${VERSION}/code-server-${VERSION}-linux-amd64.tar.gz && \
tar -zxf code-server-${VERSION}-linux-amd64.tar.gz && \
rm code-server-${VERSION}-linux-amd64.tar.gz && \
mv code-server-${VERSION}-linux-amd64 /usr/lib/code-server

ENTRYPOINT ["entrypoint-su-exec", "code-server"]
CMD ["--bind-addr 0.0.0.0:8080"]
20 changes: 9 additions & 11 deletions arm64v8/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ ENV \
# should user shell set to nologin? (yes/no) \
ENOLOGIN=no \
# container user home dir \
EHOME=/home/vscode \
# code-server version \
VERSION=3.12.0
EHOME=/home/vscode

COPY code-server /usr/bin/
RUN chmod +x /usr/bin/code-server
Expand All @@ -30,14 +28,14 @@ RUN \
openssh-client

RUN \
wget https://github.com/cdr/code-server/releases/download/v$VERSION/code-server-$VERSION-linux-arm64.tar.gz && \
tar x -zf code-server-$VERSION-linux-arm64.tar.gz && \
rm code-server-$VERSION-linux-arm64.tar.gz && \
rm code-server-$VERSION-linux-arm64/node && \
rm code-server-$VERSION-linux-arm64/code-server && \
rm code-server-$VERSION-linux-arm64/lib/node && \
mv code-server-$VERSION-linux-arm64 /usr/lib/code-server && \
sed -i 's/"$ROOT\/lib\/node"/node/g' /usr/lib/code-server/bin/code-server
export VERSION=$(curl -sX GET https://api.github.com/repos/coder/code-server/releases/latest | awk '/tag_name/{print $4;exit}' FS='[""]' | sed 's|^v||') && \
echo "******************" && \
echo "Version : $VERSION" && \
echo "******************" && \
curl -fsSL -o code-server-${VERSION}-linux-arm64.tar.gz https://github.com/coder/code-server/releases/download/v${VERSION}/code-server-${VERSION}-linux-arm64.tar.gz && \
tar -zxf code-server-${VERSION}-linux-arm64.tar.gz && \
rm code-server-${VERSION}-linux-arm64.tar.gz && \
mv code-server-${VERSION}-linux-arm64 /usr/lib/code-server

ENTRYPOINT ["entrypoint-su-exec", "code-server"]
CMD ["--bind-addr 0.0.0.0:8080"]