Skip to content

Commit

Permalink
docker is set
Browse files Browse the repository at this point in the history
  • Loading branch information
Neliz3 committed May 15, 2024
1 parent 040dafe commit 03f4a7e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

## Table of contents
* [Technologies Used](#Technologies-Used)
* [Installation](#Installation)
* [How to use it](#How-to-use-it)
* [How to run](#How-to-run)



Expand All @@ -15,8 +14,9 @@


## How to run:

1. Using docker container:
- Create your own .env file with keys listed in sample.env, then you can fill the values.
- Set the specified values of build_args in docker-compose file.
- Run docker-compose up to fetch and build images need for this project.
Run the following commands:
1. To create a Docker image:
```docker build -f build Dockerfile -t neos .```
2. Go to https://api.nasa.gov/ and generate your own API key.
3. Enter a generated API key:
```docker run -e API_KEY='DEMO_KEY' neos ```
11 changes: 5 additions & 6 deletions build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ FROM golang:latest

ARG API_KEY

COPY ./ ./
COPY ./ /app

WORKDIR /app

ENV HOME /
ENV HOME=/
ENV API_KEY=${API_KEY}

ENTRYPOINT ["{API_KEY}"]

WORKDIR /NEOs/
CMD ["go", "run", "./cmd/main.go"]
CMD ["go", "run", "./cmd/main.go"]
8 changes: 4 additions & 4 deletions configs/configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ type Config struct {
Link string
}

func ReadConfigs(api_key ...string) *Config {
func ReadConfigs() *Config {
var API_KEY string

if api_key != nil {
API_KEY = api_key[0]
} else {
API_KEY = os.Getenv("API_KEY")

if API_KEY == "" {
API_KEY = os.Getenv("DEMO_API_KEY")
}

Expand Down

0 comments on commit 03f4a7e

Please sign in to comment.