Skip to content

Commit

Permalink
Merge pull request #9 from bitofsky/2024-03
Browse files Browse the repository at this point in the history
update
  • Loading branch information
bitofsky authored Mar 14, 2024
2 parents 2bfd247 + e476a82 commit 3e1c02d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 34 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:

# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
uses: docker/setup-buildx-action@v3.2.0

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
Expand All @@ -72,7 +72,7 @@ jobs:
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
uses: docker/build-push-action@v5.3.0
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
Expand Down
42 changes: 16 additions & 26 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
FROM node:18.12.0-slim
FROM node:18.12.0-slim as builder

ENV DEBIAN_FRONTEND noninteractive
ENV PNPM_VERSION 8.6.12
ENV TURBO_VERSION 1.12.4
ENV TSX_VERSION 4.7.1
ENV TS_NODE 10.9.2
ENV SWC_CORE 1.4.2
ENV AWS_CLI 2.15.21
ENV AWS_CLI 2.15.28

RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
software-properties-common \
ca-certificates \
build-essential \
wget \
jq \
patch \
python3 \
curl \
unzip \
git && \
unzip && \
apt-get clean

# install awscli v2. see https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
Expand All @@ -30,14 +20,9 @@ RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64-${AWS_CLI}.zip" -
&& rm -rf /tmp/aws

# install node packages
RUN npm i -g pnpm@${PNPM_VERSION} turbo@${TURBO_VERSION} tsx@${TSX_VERSION} ts-node@${TS_NODE} @swc/core@${SWC_CORE}
RUN npm i -g pnpm@${PNPM_VERSION}

# install genuinetools/img for containerize without privileged
RUN curl -fSL "https://github.com/genuinetools/img/releases/download/v0.5.11/img-linux-amd64" -o "/usr/bin/img" \
&& echo "cc9bf08794353ef57b400d32cd1065765253166b0a09fba360d927cfbd158088 /usr/bin/img" | sha256sum -c - \
&& chmod a+x "/usr/bin/img"

RUN curl -L "https://github.com/moby/buildkit/releases/download/v0.11.4/buildkit-v0.11.4.linux-amd64.tar.gz" -o /tmp/buildkit.tar.gz \
RUN curl -L "https://github.com/moby/buildkit/releases/download/v0.13.0/buildkit-v0.13.0.linux-amd64.tar.gz" -o /tmp/buildkit.tar.gz \
&& mkdir -p /tmp/buildkit \
&& tar -C /tmp/buildkit -xzf /tmp/buildkit.tar.gz \
&& mv /tmp/buildkit/bin/buildctl /usr/bin/buildctl \
Expand All @@ -50,14 +35,19 @@ RUN curl -L "https://dl.k8s.io/release/v1.27.11/bin/linux/amd64/kubectl" -o "/us
RUN curl -L "https://dl.k8s.io/release/v1.28.7/bin/linux/amd64/kubectl" -o "/usr/bin/kubectl-v1.28"
RUN curl -L "https://dl.k8s.io/release/v1.29.2/bin/linux/amd64/kubectl" -o "/usr/bin/kubectl-v1.29" && chmod a+x /usr/bin/kubectl*

RUN ln -s /usr/bin/kubectl-v1.24 /usr/bin/kubectl
RUN ln -s /usr/bin/kubectl-v1.29 /usr/bin/kubectl

# runner
FROM node:18.12.0-slim as runner
COPY --link --from=builder /usr /usr

# install golang
COPY --from=golang:1.20.2 /usr/local/go/ /usr/local/go/
COPY --link --from=golang:1.20.2 /usr/local/go/ /usr/local/go/
ENV GOPATH /go
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
ENV PATH $GOPATH/bin:/usr/local/go/bin:/usr/bin:${PATH}

RUN ln -s /bin/bash /usr/bin/bash && \
ln -s /bin/sh /usr/bin/sh
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH" && \
ln -s /bin/bash /usr/bin/bash && \
ln -s /bin/sh /usr/bin/sh && \
npm i -g pnpm@${PNPM_VERSION}

ENV PATH $GOPATH/bin:/usr/local/go/bin:/usr/bin:${PATH}
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,10 @@ Container Image for Node.js and Golang Development
Includes:
- Node.js 18.12.0
- PNPM 8.6.12
- Turbo 1.12.4
- TSX 4.7.1
- Golang 1.20.2
- Docker base image: node:18.12.0-slim
- Additional tools: software-properties-common, ca-certificates, build-essential, wget, jq, patch, awscli v2, python3, curl, git
- genuinetools/img v0.5.11
- Additional tools: ca-certificates, awscli v2, python3, curl
- Moby BuildKit v0.11.4
- kubectl v1.27 ~ v1.29 (default v1.29)
- ts-node 10.9.2
- @swc/core 1.4.2

This container image is designed for both Node.js and Golang development. It includes a variety of packages and tools that will streamline your workflow and improve productivity.

0 comments on commit 3e1c02d

Please sign in to comment.