-
Notifications
You must be signed in to change notification settings - Fork 1
/
nomad.Dockerfile
36 lines (28 loc) · 1.09 KB
/
nomad.Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
FROM ubuntu:22.04
LABEL maintainer="Karan Sharma <https://github.com/mr-karan>"
EXPOSE 4646 4647 4648 4648/udp
ARG NOMAD_VERSION=1.3.0
# Create directories for data/config.
RUN mkdir -p /opt/nomad/data && \
mkdir -p /etc/nomad.d
# Packages required for nomad.
RUN apt-get update && apt-get install -y \
unzip \
curl \
iproute2 \
vim \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Install Nomad
WORKDIR /tmp
RUN curl -sSL https://releases.hashicorp.com/nomad/${NOMAD_VERSION}/nomad_${NOMAD_VERSION}_linux_amd64.zip -o nomad.zip \
&& unzip nomad.zip \
&& mv nomad /usr/bin/nomad
# Install CNI (https://www.nomadproject.io/docs/integrations/consul-connect)
RUN curl -L -o cni-plugins.tgz \
"https://github.com/containernetworking/plugins/releases/download/v1.1.1/cni-plugins-linux-$( [ $(uname -m) = aarch64 ] && echo arm64 || echo amd64)"-v1.1.1.tgz && \
mkdir -p /opt/cni/bin && \
tar -C /opt/cni/bin -xzf cni-plugins.tgz
# Copy a default config.
COPY configs/nomad.hcl /etc/nomad.d/nomad.hcl
CMD ["/usr/bin/nomad", "agent", "-config", "/etc/nomad.d"]