diff --git a/Dockerfile b/Dockerfile index 6309c55d8..76fa18eae 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,50 +1,22 @@ # VERSION: 0.1 -# DESCRIPTION: Create the atom editor in a container -# AUTHOR: Jessica Frazelle -# COMMENTS: -# This file describes how to build the atom editor -# in a container with all dependencies installed. -# Tested on Debian Jessie. -# USAGE: -# # Download atom Dockerfile -# wget http://raw.githubusercontent.com/atom/atom/master/Dockerfile -# -# # Build atom image -# docker build -t atom . -# -# docker run -v /tmp/.X11-unix:/tmp/.X11-unix \ -# -e DISPLAY=unix$DISPLAY atom -# - -DOCKER-VERSION 1.3 +# DESCRIPTION: Image to build Atom and create a .rpm file # Base docker image -FROM debian:jessie -MAINTAINER Jessica Frazelle +FROM fedora:20 # Install dependencies -RUN apt-get update && apt-get install -y \ - build-essential \ - ca-certificates \ - curl \ - git \ - libasound2 \ - libgconf-2-4 \ - libgnome-keyring-dev \ - libgtk2.0-0 \ - libnss3 \ - libxtst6 \ - --no-install-recommends +RUN yum install -y \ + make \ + gcc \ + gcc-c++ \ + glibc-devel \ + git-core \ + libgnome-keyring-devel \ + rpmdevtools -# install node -RUN curl -sL https://deb.nodesource.com/setup | bash - -RUN apt-get install -y nodejs +# Install node +RUN curl -sL https://rpm.nodesource.com/setup | bash - +RUN yum install -y nodejs -# clone atom -RUN git clone https://github.com/atom/atom /src -WORKDIR /src -RUN git fetch && git checkout $(git describe --tags `git rev-list --tags --max-count=1`) -RUN script/build && script/grunt install - -# Autorun atom -CMD /usr/local/bin/atom --foreground --log-file /var/log/atom.log && tail -f /var/log/atom.log +ADD . /atom +WORKDIR /atom diff --git a/build/debian/Dockerfile b/build/debian/Dockerfile new file mode 100644 index 000000000..6309c55d8 --- /dev/null +++ b/build/debian/Dockerfile @@ -0,0 +1,50 @@ +# VERSION: 0.1 +# DESCRIPTION: Create the atom editor in a container +# AUTHOR: Jessica Frazelle +# COMMENTS: +# This file describes how to build the atom editor +# in a container with all dependencies installed. +# Tested on Debian Jessie. +# USAGE: +# # Download atom Dockerfile +# wget http://raw.githubusercontent.com/atom/atom/master/Dockerfile +# +# # Build atom image +# docker build -t atom . +# +# docker run -v /tmp/.X11-unix:/tmp/.X11-unix \ +# -e DISPLAY=unix$DISPLAY atom +# + +DOCKER-VERSION 1.3 + +# Base docker image +FROM debian:jessie +MAINTAINER Jessica Frazelle + +# Install dependencies +RUN apt-get update && apt-get install -y \ + build-essential \ + ca-certificates \ + curl \ + git \ + libasound2 \ + libgconf-2-4 \ + libgnome-keyring-dev \ + libgtk2.0-0 \ + libnss3 \ + libxtst6 \ + --no-install-recommends + +# install node +RUN curl -sL https://deb.nodesource.com/setup | bash - +RUN apt-get install -y nodejs + +# clone atom +RUN git clone https://github.com/atom/atom /src +WORKDIR /src +RUN git fetch && git checkout $(git describe --tags `git rev-list --tags --max-count=1`) +RUN script/build && script/grunt install + +# Autorun atom +CMD /usr/local/bin/atom --foreground --log-file /var/log/atom.log && tail -f /var/log/atom.log diff --git a/build/tasks/mkrpm-task.coffee b/build/tasks/mkrpm-task.coffee index ebc4cfb73..8590049b5 100644 --- a/build/tasks/mkrpm-task.coffee +++ b/build/tasks/mkrpm-task.coffee @@ -3,7 +3,7 @@ path = require 'path' _ = require 'underscore-plus' module.exports = (grunt) -> - {spawn} = require('./task-helpers')(grunt) + {spawn, rm, mkdir} = require('./task-helpers')(grunt) fillTemplate = (filePath, data) -> template = _.template(String(fs.readFileSync("#{filePath}.in"))) @@ -25,6 +25,11 @@ module.exports = (grunt) -> {name, version, description} = grunt.file.readJSON('package.json') buildDir = grunt.config.get('atom.buildDir') + + rpmDir = path.join(buildDir, 'rpm') + rm rpmDir + mkdir rpmDir + installDir = grunt.config.get('atom.installDir') shareDir = path.join(installDir, 'share', 'atom') iconName = path.join(shareDir, 'resources', 'app', 'resources', 'atom.png') @@ -39,5 +44,5 @@ module.exports = (grunt) -> if error? done(error) else - grunt.log.ok "Created rpm package in #{buildDir}" + grunt.log.ok "Created rpm package in #{rpmDir}" done() diff --git a/build/tasks/publish-build-task.coffee b/build/tasks/publish-build-task.coffee index d7a3b8139..89d791197 100644 --- a/build/tasks/publish-build-task.coffee +++ b/build/tasks/publish-build-task.coffee @@ -38,6 +38,9 @@ module.exports = (gruntObject) -> grunt.log.ok("Upload time: #{elapsedTime}s") doneCallback(args...) + unless token + return done(new Error('ATOM_ACCESS_TOKEN environment variable not set')) + buildDir = grunt.config.get('atom.buildDir') assets = getAssets() @@ -69,9 +72,21 @@ getAssets = -> else arch = 'amd64' {version} = grunt.file.readJSON('package.json') + + # Check for a Debian build sourcePath = "#{buildDir}/atom-#{version}-#{arch}.deb" assetName = "atom-#{arch}.deb" + # Check for a Fedora build + unless fs.isFileSync(sourcePath) + rpmName = fs.readdirSync("#{buildDir}/rpm")[0] + sourcePath = "#{buildDir}/rpm/#{rpmName}" + if process.arch is 'ia32' + arch = 'i386' + else + arch = 'x64_64' + assetName = "atom.#{arch}.rpm" + {cp} = require('./task-helpers')(grunt) cp sourcePath, path.join(buildDir, assetName) diff --git a/script/cibuild-atom-rpm b/script/cibuild-atom-rpm new file mode 100755 index 000000000..d42038ea2 --- /dev/null +++ b/script/cibuild-atom-rpm @@ -0,0 +1,10 @@ +#!/bin/bash + +set -e + +docker build -t atom-rpm . +docker run \ + --env JANKY_SHA1="$JANKY_SHA1" \ + --env JANKY_BRANCH="$JANKY_BRANCH" \ + --env ATOM_ACCESS_TOKEN="$BUILD_ATOM_RPM_ACCESS_TOKEN" \ + atom-rpm /atom/script/rpmbuild diff --git a/script/mkrpm b/script/mkrpm index c0450a590..356f0bfc4 100755 --- a/script/mkrpm +++ b/script/mkrpm @@ -17,6 +17,6 @@ cp ./atom.sh $RPM_BUILD_ROOT/BUILD cp $DESKTOP_FILE $RPM_BUILD_ROOT/BUILD rpmbuild -ba $SPEC_FILE -cp $RPM_BUILD_ROOT/RPMS/$ARCH/atom-*.rpm $BUILD_DIRECTORY +cp $RPM_BUILD_ROOT/RPMS/$ARCH/atom-*.rpm $BUILD_DIRECTORY/rpm rm -rf $RPM_BUILD_ROOT diff --git a/script/rpmbuild b/script/rpmbuild new file mode 100755 index 000000000..9405fd585 --- /dev/null +++ b/script/rpmbuild @@ -0,0 +1,6 @@ +#!/bin/sh + +set -e + +script/build +script/grunt mkrpm publish-build --stack