Create a lightweight STNS Docker image

Since the Docker image of the STNS server is large, I made a lightweight Docker image.

cdsl-research/stns-container

Constitution

The build environment and execution environment are separated by using multi-stage build.

--Multi-stage build --Build-time image: golang: 1.15.6-alpine3.12 --Runtime image: alpine: 3.12

Comparison

We have achieved a ** 68% size reduction ** compared to the officially provided Docker image.

$ docker images | grep stns
stns-server                                                      latest                                           98a315731b33   41 minutes ago   69.2MB
stns/stns                                                        latest                                           597e448def6a   9 days ago       219MB

Dockerfile

FROM golang:1.15.6-alpine3.12 AS builder
WORKDIR /tmp
ENV BUILD=/artifacts
RUN apk --no-cache update && \
    apk --no-cache upgrade && \
    apk --no-cache add make alpine-sdk gcc openssl libcurl git && \
    git clone https://github.com/STNS/STNS.git && \
    cd STNS/ && \
    mkdir -p $BUILD && \
    make install MODDIR=$BUILD BINDIR=$BUILD

FROM alpine:3.12
EXPOSE 1104/tcp
WORKDIR /stns
COPY --from=builder /artifacts /stns
COPY config.toml /stns
ENTRYPOINT ["/stns/stns", "--config", "/stns/config.toml", "server"]

Recommended Posts

Create a lightweight STNS Docker image
Docker Compact Manual (4: Create a custom image)
Create a docker image that runs a simple Java app
How to create a lightweight container image for Java apps
Create a Docker image with the Oracle JDK installed (yum
2. Create Docker image and register Registry
Use Jenkins to build inside Docker and then create a Docker image.
Create a Docker Image for redoc-cli and register it on Docker Hub
Create a web environment quickly using Docker
Create a MySQL environment with Docker from 0-> 1
[Memo] Create a CentOS 8 environment easily with Docker
Create a Privoxy + Tor environment instantly using Docker
Create a Lambda Container Image based on Java 15
Create a docker environment for Oracle 11g XE
Create a Spring Boot development environment with docker
How to create a small docker image of openjdk 11 (ea) application (1GB → 85MB)
[Introduction to Docker] Create a Docker image for machine learning and use Jupyter notebook
I made a Docker image of SDAPS for Japanese
How to deploy to Heroku from a local docker image
[Java] Create a filter
I tried using Wercker to create and publish a Docker image that launches GlassFish 5.
Create a Docker container to convert EPS to PGF source
Delete unused docker image
[Note] Create a java environment from scratch with docker
Creating a lightweight Java environment that runs on Docker
Maybe it works! Create an image with Docker and share it!
Build Docker Image lightweight and fast with CodeBuild with Santa Banner
[Personal notes] How to push a Docker image to GitHub Packages
Create a Kibana container image for ARM64 (Raspberry Pi/Mac M1)
I tried to create a padrino development environment with Docker
[Docker] Create Elasticsearch, Kibana environment!
Install yarn in docker image
docker review image creation-container start
Create a java method [Memo] [java11]
Extract files from Docker Image
[Java] Create a temporary file
Create a VS Code Plugin.
Create a playground with Xcode 12
Create a fortune using Ruby
How to create a method
Create a name input function
I created a Docker image of a container for learning OpenAI Gym
Create a flyway jar with maven and docker build (migrate) with docker-maven-plugin
Set up a Wordpress Docker environment without using the Worpdress image
Run (provisionally) a Docker image with ShellCommandActivity on AWS Data Pipeline