From 87381dc6833d6226ddc79ac8e0482f3dd16dee8a Mon Sep 17 00:00:00 2001 From: Tarcisio Coutinho Date: Wed, 19 Apr 2023 08:27:30 -0300 Subject: [PATCH] docker config selfadaptive --- .dockerignore | 2 ++ Dockerfile | 14 ++++++++++++++ run-docker | 17 +++++++++++++++++ shared/shared.go | 4 ++-- 4 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100755 run-docker diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..b324198 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +Dockerfile +run-docker \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..820f835 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +# Define go base image and version +FROM golang:1.20.3-alpine + +# Install g++ dependency (for plugin build) +RUN apk --update add g++ + +# Define GOROOT variable +ENV GOROOT=/usr/local/go + +# Copy project files to container +COPY . /go/selfadaptive + +# Change base path +WORKDIR /go/selfadaptive \ No newline at end of file diff --git a/run-docker b/run-docker new file mode 100755 index 0000000..dd28e5a --- /dev/null +++ b/run-docker @@ -0,0 +1,17 @@ +#!/bin/bash + +# Creates docker image +# -t => [tag image] (name:tag) +# . => context of build (current directory dot) +docker build -t selfadaptive:latest . + +# Executes docker container (The container is an instance of an image) +# --rm => when stoped the container will be removed (but the container image remains) +# -it => 'binds' iterative shell to container terminal +docker run --rm -it selfadaptive:latest sh + + + +# Go Build Plugin +# -buildmode=plugin + diff --git a/shared/shared.go b/shared/shared.go index eb25acf..54d7c7c 100644 --- a/shared/shared.go +++ b/shared/shared.go @@ -51,8 +51,8 @@ const NumberOfColors = 7 const ColorReset = "\033[0m" // Base Directories -const SourcesDir = "/Volumes/GoogleDrive/Meu Drive/go/selfadaptive/example-plugin/envrnment/plugins/source" -const ExecutablesDir = "/Volumes/GoogleDrive/Meu Drive/go/selfadaptive/example-plugin/envrnment/plugins/executable" +const SourcesDir = "/go/selfadaptive/example-plugin/envrnment/plugins/source" +const ExecutablesDir = "/go/selfadaptive/example-plugin/envrnment/plugins/executable" //const SourcesDir = "C:\\Users\\user\\go\\selfadaptive\\example-plugin\\envrnment\\sources" //const ExecutablesDir = "C:\\Users\\user\\go\\selfadaptive\\example-plugin\\envrnment\\executables"