Skip to content

Commit

Permalink
Travis CI will now build a container image.
Browse files Browse the repository at this point in the history
Signed-off-by: Paulo Pires <pjpires@gmail.com>
  • Loading branch information
pires committed Aug 11, 2017
1 parent 66b1844 commit 8808829
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 9 deletions.
20 changes: 20 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
sudo: required

services:
- docker

before_install:
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
- sudo apt-get update
- sudo apt-get -y install docker-ce

script:
- docker build -t "quay.io/travelaudience/docker-nexus-proxy:${TRAVIS_TAG:-latest}" .

after_success:
- if ([[ "${TRAVIS_BRANCH}" == "master" ]] && [[ "${TRAVIS_PULL_REQUEST}" == "false" ]]) || [[ ! -z "${TRAVIS_TAG}" ]];
then
docker login -u "${DOCKER_USERNAME}" -p "${DOCKER_PASSWORD}" quay.io;
docker push "quay.io/travelaudience/docker-nexus-proxy:${TRAVIS_TAG:-latest}";
fi
37 changes: 37 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
FROM openjdk:8u131-jdk-alpine AS builder
COPY ./ /src/
WORKDIR /src/
RUN ./gradlew --info --no-daemon build
RUN ls -la /src/build/libs/

FROM quay.io/pires/docker-jre:8u131_alpine3.6.2

ENV ALLOWED_USER_AGENTS_ON_ROOT_REGEX "GoogleHC"
ENV AUTH_CACHE_TTL "300"
ENV BIND_PORT "8080"
ENV CLIENT_ID "REPLACE_ME"
ENV CLIENT_SECRET "REPLACE_ME"
ENV CLOUD_IAM_AUTH_ENABLED "false"
ENV KEYSTORE_PATH "keystore.jceks"
ENV KEYSTORE_PASS "safe#passw0rd!"
ENV NEXUS_DOCKER_HOST "containers.example.com"
ENV NEXUS_HTTP_HOST "nexus.example.com"
ENV NEXUS_RUT_HEADER "X-Forwarded-User"
ENV ORGANIZATION_ID "REPLACE_ME"
ENV REDIRECT_URL "https://nexus.example.com/oauth/callback"
ENV SESSION_TTL "1440000"
ENV TLS_CERT_PK12_PATH "cert.pk12"
ENV TLS_CERT_PK12_PASS "safe#passw0rd!"
ENV TLS_ENABLED "false"
ENV UPSTREAM_DOCKER_PORT "5003"
ENV UPSTREAM_HOST "localhost"
ENV UPSTREAM_HTTP_PORT "8081"

COPY --from=builder /src/build/libs/nexus-proxy.jar /nexus-proxy.jar

EXPOSE 8080
EXPOSE 8443

CMD ["-jar", "/nexus-proxy.jar"]

ENTRYPOINT ["java"]
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# nexus-proxy

[![Build Status](https://travis-ci.org/travelaudience/nexus-proxy.svg?branch=master)](https://travis-ci.org/travelaudience/nexus-proxy)
[![Docker Repository on Quay](https://quay.io/repository/travelaudience/docker-nexus-proxy/status "Docker Repository on Quay")](https://quay.io/repository/travelaudience/docker-nexus-proxy)

A proxy for Nexus Repository Manager that allows for optional authentication against external identity providers.

## Introduction
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package com.travelaudience.nexus.proxy;

import static java.util.stream.Collectors.toMap;
import static org.junit.Assert.assertEquals;

import io.vertx.core.Vertx;
import io.vertx.core.http.HttpHeaders;
import io.vertx.ext.unit.Async;
Expand All @@ -20,16 +17,16 @@
import java.io.IOException;
import java.io.UncheckedIOException;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.ServerSocket;
import java.net.URL;
import java.net.URLDecoder;
import java.net.*;
import java.util.AbstractMap;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Pattern;

import static java.util.stream.Collectors.toMap;
import static org.junit.Assert.assertEquals;

@RunWith(PowerMockRunner.class)
@PowerMockRunnerDelegate(VertxUnitRunner.class)
@PrepareForTest(CloudIamAuthNexusProxyVerticle.class)
Expand Down Expand Up @@ -152,7 +149,7 @@ private static final URL buildUrl(final String url) {
}

private static final int findRandomUnusedPort() {
try (final ServerSocket socket = new ServerSocket(0)) {
try (final ServerSocket socket = new ServerSocket(0, 50, InetAddress.getLocalHost())) {
return socket.getLocalPort();
} catch (final IOException ex) {
throw new UncheckedIOException(ex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import java.io.IOException;
import java.io.UncheckedIOException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.util.HashMap;
import java.util.Map;
Expand Down Expand Up @@ -75,7 +76,7 @@ public void root_responds_with_200_to_allowed_user_agents(final TestContext ctx)
}

private static final int findRandomUnusedPort() {
try (final ServerSocket socket = new ServerSocket(0)) {
try (final ServerSocket socket = new ServerSocket(0, 50, InetAddress.getLocalHost())) {
return socket.getLocalPort();
} catch (final IOException ex) {
throw new UncheckedIOException(ex);
Expand Down

0 comments on commit 8808829

Please sign in to comment.