Skip to content

Commit

Permalink
feat: Dockerfile and Makefile Snippets (#705)
Browse files Browse the repository at this point in the history
Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <erik@cloudposse.com>
  • Loading branch information
milldr and osterman authored Oct 3, 2024
1 parent e8f169e commit 385b2b2
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 43 deletions.
30 changes: 26 additions & 4 deletions docs/layers/project/toolbox.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import Intro from '@site/src/components/Intro';
import ActionCard from '@site/src/components/ActionCard';
import PrimaryCTA from '@site/src/components/PrimaryCTA';
import DismissibleDialog from '@site/src/components/DismissibleDialog';
import CodeBlock from '@theme/CodeBlock';
import CollapsibleText from '@site/src/components/CollapsibleText';
import PartialDockerfile from '@site/examples/snippets/components/docker/infra-acme/Dockerfile';
import PartialMakefile from '@site/examples/snippets/Makefile';
import Note from '@site/src/components/Note';

<Intro>
Expand All @@ -33,18 +37,36 @@ Geodesic is a powerful Linux toolbox container designed to optimize DevOps workf

## Building the Toolbox Image

Build the Geodesic infrastructure container. This is a container that has all the tools for building the app. It's built
from the `Dockerfile` using a `Makefile`.
Build a Geodesic infrastructure container. This container that has all the tools like terraform and atmos for building infrastructure. It's built from the `Dockerfile` and there are some predefined targets defined in the `Makefile` to make this easy. Customize these for your organization. Here are examples of both for reference.

The standard `Makefile` includes a number of commands. In order to build the initial, complete Geodesic image, run the
following:
<CollapsibleText type="medium">
<CodeBlock title="Dockerfile">{PartialDockerfile}</CodeBlock>
</CollapsibleText>

<CollapsibleText type="medium">
<CodeBlock title="Makefile">{PartialMakefile}</CodeBlock>
</CollapsibleText>

The standard `Makefile` includes a number of commands. In order to build the initial, complete Geodesic image, run the following:

```bash
make all
```

On future builds, use `make run` to use the cached image.

:::tip Alias

We install a wrapper script with `make all` to your chosen namespace. For example, simply enter for given namespace to start your Geodesic container once built:

```bash
acme
```

See the `install` step of the `Makefile` for more details.

:::

Build the toolbox image locally before continuing.

Follow the [toolbox image setup steps in the How-to Get Started guide](/layers/project/#building-the-toolbox-image). In short,
Expand Down
4 changes: 1 addition & 3 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ async function createConfig() {
disableInDev: false,
}
],
[
'custom-loaders', {}
],
path.resolve(__dirname, 'plugins/custom-loaders'),
metadataPlugin,
[
"posthog-docusaurus",
Expand Down
1 change: 1 addition & 0 deletions examples/snippets/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# placeholder until example is created
67 changes: 33 additions & 34 deletions plugins/custom-loaders/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,41 +8,40 @@ const html = require('html-loader');
const path = require('path');

module.exports = function (context, options) {
return {
name: 'custom-loaders',
configureWebpack(config, isServer) {
return {
/*output: {
filename: 'custom-loaders-webpack.bundle.js',
},*/

module: {
rules: [
// { test: /\.txt$/, use: 'raw-loader' },
// https://webpack.js.org/loaders/html-loader/
{
test: /\.(html|htm)$/i,
loader: "html-loader",
options: {
minimize: {
removeComments: false,
collapseWhitespace: false,
},
return {
name: 'custom-loaders',
configureWebpack(config, isServer) {
return {
module: {
rules: [
// Existing rule for HTML files
{
test: /\.(html|htm)$/i,
loader: 'html-loader',
options: {
minimize: {
removeComments: false,
collapseWhitespace: false,
},
},
{
test: /\.(txt|yml|yaml|tf)$/,
use: 'raw-loader'
}
],
},
},
{
test: /\.(txt|yml|yaml|tf)$/i,
use: 'raw-loader',
},
{
test: /(?:Dockerfile|Makefile)$/i,
use: 'raw-loader',
},
],
},

resolve: {
alias: {
'@examples': path.resolve(__dirname, 'examples'),
}
}
};
},
};
resolve: {
alias: {
'@examples': path.resolve(__dirname, 'examples'),
},
},
};
},
};
};
4 changes: 2 additions & 2 deletions plugins/dynamicRedirects/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ async function loadRedirects(allContent) {
}
});

console.debug('Loaded redirects:', redirects);
// console.debug('Loaded redirects:', redirects);
return redirects;
}

Expand All @@ -60,7 +60,7 @@ function redirectsPlugin(context, options) {
redirects,
});

console.debug('Global data set with redirects.');
// console.debug('Global data set with redirects.');
},
};
}
Expand Down

0 comments on commit 385b2b2

Please sign in to comment.