Skip to content

Vundenham/wegoDockerized

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Wego Docker Image

This project builds a Docker image for Wego, a CLI weather application. The image is built in a multi-stage Dockerfile that compiles the Go binary statically (with CGO disabled) for compatibility with a minimal Alpine Linux image.

Features

  • Runtime Configuration: Uses environment variables (OWM_API_KEY and LOCATION) to dynamically update the generated Wego configuration file (~/.wegorc) at container startup.
  • Wrapper Script: A shell script (runWego.sh) ensures configuration values are updated before starting the application.

Prerequisites

  • Docker installed on your system.
  • A valid OpenWeatherMap API key.

Build the Image

Run the following command in the project directory:

docker build -t wego .

Running the Image

You can supply the following environment variables at runtime:

  • OWM_API_KEY: Your OpenWeatherMap API key.
  • LOCATION: The desired location for weather forecasting.

For example:

docker run -e OWM_API_KEY=YOUR_KEY -e LOCATION=YOUR_LOCATION wego

To get the status of your weather after configurations have been made:

docker start -ai wego

Files

  • Dockerfile: Multi-stage build file.
  • runWego.sh: Startup script that updates the configuration file (~/.wegorc) from environment variables and executes Wego.
  • .wegorc: The configuration file generated by Wego – updated during image build and runtime.

Troubleshooting

  • Static Linking: If you encounter issues with the binary not executing on Alpine, ensure that CGO_ENABLED=0 is set during the build.
  • Configuration Issues: The script checks ~/.wegorc for existing default values and updates them with provided environment variables. You can override these by passing variables at runtime.

About

Dockerized wego

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published