<commit_before>package fr.treeptik.cloudunit.utils;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import fr.treeptik.cloudunit.docker.builders.ConfigBuilder;
import fr.treeptik.cloudunit.docker.builders.ContainerBuilder;
import fr.treeptik.cloudunit.docker.builders.HostConfigBuilder;
import fr.treeptik.cloudunit.docker.model.Config;
import fr.treeptik.cloudunit.docker.model.DockerContainer;
import fr.treeptik.cloudunit.docker.model.HostConfig;

/**
 * Created by guillaume on 11/01/16.
 */
public class ContainerUtils {

    public static DockerContainer newCreateInstance(String name, String imagePath, String imageSubType, List<String> volumesFrom,
            List<String> args, List<String> rawVolumes, List<String> envs,
            Map<String, String> ports, String networkMode, String suffixCloudUnitIO) {
        HostConfig hostConfig = HostConfigBuilder.aHostConfig().withVolumesFrom(volumesFrom).withBinds(rawVolumes)
                .withPublishAllPorts(false).withPortBindings(buildPortBindingBody(ports))
                .withNetworkMode(networkMode)
                .build();
        Config config = ConfigBuilder.aConfig().withAttachStdin(Boolean.FALSE).withAttachStdout(Boolean.TRUE)
                .withHostname(name)
                .withAttachStderr(Boolean.TRUE).withCmd(args).withImage(imagePath).withHostConfig(hostConfig).withMemory(0L)
                .withMemorySwap(0L).withEnv(envs).build();
        Map<String, String> labels = new HashMap<>();
        if ("webserver".equalsIgnoreCase(imageSubType)) {
            labels.put("traefik.port", "80");
        } else {
            labels.put("traefik.port", "8080");
        }
        labels.put("traefik.backend", name);
        labels.put("traefik.frontend.rule", "Host:" + name + suffixCloudUnitIO);
        config.setLabels(labels);
        DockerContainer container = ContainerBuilder.aContainer().withName(name).withConfig(config).build();
        return container;
    }
<commit_msg>Correct the tag rule namings for traefik<commit_after>package fr.treeptik.cloudunit.utils;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import fr.treeptik.cloudunit.docker.builders.ConfigBuilder;
import fr.treeptik.cloudunit.docker.builders.ContainerBuilder;
import fr.treeptik.cloudunit.docker.builders.HostConfigBuilder;
import fr.treeptik.cloudunit.docker.model.Config;
import fr.treeptik.cloudunit.docker.model.DockerContainer;
import fr.treeptik.cloudunit.docker.model.HostConfig;

/**
 * Created by guillaume on 11/01/16.
 */
public class ContainerUtils {

    public static DockerContainer newCreateInstance(String name, String imagePath, String imageSubType
            , List<String> volumesFrom, List<String> args, List<String> rawVolumes
            , List<String> envs
            , Map<String, String> ports, String networkMode, String suffixCloudUnitIO) {
        HostConfig hostConfig = HostConfigBuilder.aHostConfig().withVolumesFrom(volumesFrom).withBinds(rawVolumes)
                .withPublishAllPorts(false).withPortBindings(buildPortBindingBody(ports))
                .withNetworkMode(networkMode)
                .build();
        Config config = ConfigBuilder.aConfig().withAttachStdin(Boolean.FALSE).withAttachStdout(Boolean.TRUE)
                .withHostname(name)
                .withAttachStderr(Boolean.TRUE).withCmd(args).withImage(imagePath).withHostConfig(hostConfig).withMemory(0L)
                .withMemorySwap(0L).withEnv(envs).build();
        Map<String, String> labels = new HashMap<>();
        if ("webserver".equalsIgnoreCase(imageSubType)) {
            labels.put("traefik.port", "80");
        } else {
            labels.put("traefik.port", "8080");
        }
        labels.put("traefik.backend", name);
        String subdomain = System.getenv("CU_SUB_DOMAIN") == null ? "" : System.getenv("CU_SUB_DOMAIN");
        labels.put("traefik.frontend.rule", "Host:" + name + subdomain + suffixCloudUnitIO);
        config.setLabels(labels);
        DockerContainer container = ContainerBuilder.aContainer().withName(name).withConfig(config).build();
        return container;
    }

{'fraction_non_alphanumeric': 0.11682131810611468, 'fraction_numerical': 0.006661908160837497, 'mean_word_length': 3.599562363238512, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3438767', 'n_tokens_mistral': 1257, 'n_tokens_neox': 1215, 'n_words': 192}