Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPIN_IMAGE_* not working - referent #132 #153

Open
gsoares98 opened this issue Jan 17, 2025 · 1 comment
Open

SPIN_IMAGE_* not working - referent #132 #153

gsoares98 opened this issue Jan 17, 2025 · 1 comment

Comments

@gsoares98
Copy link

Current Behavior

Current Behavior
I set SPIN_IMAGE_DOCKERFILE and continue using image name localhost:5080/dockerfile:latest

Expected Behavior

I set SPIN_IMAGE_DOCKERFILE as localhost:5080/aplication:latest and on spin deploy create an image with name example.com:5080/aplication:latest

Steps To Reproduce

on template laravel, set on .env.production:

SPIN_IMAGE_DOCKERFILE=localhost:5080/aplication:latest
then run spin deploy, you will see the image name as localhost:5080/dockerfile:latest

Environment

Spin Version: 
v2.3.0 [stable] (User Installed)

Operating System Version: 
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Docker Info: 
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled
Client: Docker Engine - Community
 Version:    27.3.1
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.17.1
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.29.7
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 2
  Running: 1
  Paused: 0
  Stopped: 1
 Images: 16
 Server Version: 27.3.1
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 57f17b0a6295a39009d861b89e3b3b87b005ca27
 runc version: v1.1.14-0-g2c9f560
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.1.0-28-amd64
 Operating System: Debian GNU/Linux 12 (bookworm)
 OSType: linux
 Architecture: x86_64
 CPUs: 6
 Total Memory: 5.765GiB
 Name: DEV001DEB12
 ID: 6f73de1a-b251-4c02-9c05-8c92006df56c
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Anything else?

unfortunately in v3 it still continues, but I saw that the code changed little kkkk

I made the following changes, see what you think, around line 228 of the deploy.sh file I modified it and it looked like this:

spin_image_var_name="SPIN_IMAGE_${spin_image_var_name}"

# Set and export image name
+ if [ -n "${!spin_image_var_name}" ]; then
+     full_docker_image_name="${image_prefix}/${!spin_image_var_name}"
+ else 
+    full_docker_image_name="${image_prefix}/$(echo "$dockerfile" | tr '[:upper:]' '[:lower:]')"
+ fi
versioned_image="${full_docker_image_name}:${image_tag}"
latest_image="${full_docker_image_name}:latest"

# Export the versioned image name for other scripts to use
export "$spin_image_var_name=$versioned_image"

my idea here is different from the documentation, that instead of using SPIN_IMAGE_DOCKERFILE="localhost:5080/example-app:latest", I would do SPIN_IMAGE_DOCKERFILE="example-app", considering that the variables SPIN_REGISTRY_PORT, SPIN_BUILD_IMAGE_PREFIX and SPIN_BUILD_TAG already exist.

What do you think?

@jaydrogers
Copy link
Member

Thanks for the update on this! I will take a look into this and will keep you posted 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants