Archived
1
0

Add docker image pushing

This commit is contained in:
Anmol Sethi 2020-02-18 13:06:18 -05:00
parent 1a54f6b7ef
commit 1a91588c42
No known key found for this signature in database
GPG Key ID: 8CEF1878FF10ADEB
5 changed files with 34 additions and 5 deletions

View File

@ -12,20 +12,26 @@ jobs:
- stage: Release - stage: Release
name: Linux Release name: Linux Release
script: travis_wait 60 ./ci/image/run.sh "yarn && yarn vscode && ci/release.sh" script:
- travis_wait 60 ./ci/image/run.sh "yarn && yarn vscode && ci/release.sh"
- ./ci/release-image/push.sh
- name: Linux ARM64 Release - name: Linux ARM64 Release
script: travis_wait 60 ./ci/image/run.sh "yarn && yarn vscode && ci/release.sh" script:
- travis_wait 60 ./ci/image/run.sh "yarn && yarn vscode && ci/release.sh"
- ./ci/release-image/push.sh
arch: arm64 arch: arm64
- name: MacOS Release - name: MacOS Release
os: osx os: osx
language: node_js language: node_js
node_js: 12 node_js: 12
script: yarn && yarn vscode && travis_wait 60 ci/release.sh script: yarn && yarn vscode && travis_wait 60 ci/release.sh
- name: Docker Release
script: ./ci/release-image/push.sh
stages: stages:
- name: Code - name: Code
- name: Release - name: Release
if: $TRAVIS_TAG != "" if: env(TRAVIS_TAG) IS present
deploy: deploy:
- provider: releases - provider: releases

View File

@ -4,6 +4,8 @@ set -euo pipefail
main() { main() {
cd "$(dirname "$0")/../.." cd "$(dirname "$0")/../.."
docker build ci/image
imageTag="$(docker build -q ci/image)" imageTag="$(docker build -q ci/image)"
docker run -t --rm -e CI -e GITHUB_TOKEN -v "$(yarn cache dir):/usr/local/share/.cache/yarn/v6" -v "$PWD:/repo" -w /repo "$imageTag" "$*" docker run -t --rm -e CI -e GITHUB_TOKEN -v "$(yarn cache dir):/usr/local/share/.cache/yarn/v6" -v "$PWD:/repo" -w /repo "$imageTag" "$*"
} }

View File

@ -1 +0,0 @@
code-server*.tar.gz

View File

@ -3,7 +3,7 @@ FROM debian:10
RUN apt-get update RUN apt-get update
RUN apt-get install -y curl RUN apt-get install -y curl
COPY code-server*.tar.gz /tmp COPY release/code-server*.tar.gz /tmp
RUN cd /tmp && tar -xzf code-server*.tar.gz && \ RUN cd /tmp && tar -xzf code-server*.tar.gz && \
cp code-server*/code-server /usr/local/bin/code-server cp code-server*/code-server /usr/local/bin/code-server
RUN rm -rf /tmp/* RUN rm -rf /tmp/*

22
ci/release-image/push.sh Executable file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env bash
set -euo pipefail
main() {
cd "$(dirname "$0")/../.."
if [[ ${CI:-} ]]; then
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
fi
imageTag="codercom/code-server:$VERSION"
latest="codercom/code-server:latest"
if [[ $TRAVIS_CPU_ARCH == "arm64" ]]; then
imageTag+="-arm64"
latest="codercom/code-server:arm64"
fi
docker build -t "$imageTag" -t "$latest" -f ./ci/release-image/Dockerfile
docker push codercom/code-server
}
main "$@"